ooo-build r12168 - trunk/patches/src680



Author: freuter
Date: Tue Apr 15 16:31:00 2008
New Revision: 12168
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12168&view=rev

Log:
BOF for checkboxes...

Added:
   trunk/patches/src680/sw-field-checkbox.diff

Added: trunk/patches/src680/sw-field-checkbox.diff
==============================================================================
--- (empty file)
+++ trunk/patches/src680/sw-field-checkbox.diff	Tue Apr 15 16:31:00 2008
@@ -0,0 +1,158 @@
+diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
+index afd816b..69f5bf4 100644
+--- sw/source/ui/docvw/edtwin.cxx
++++ sw/source/ui/docvw/edtwin.cxx
+@@ -4270,6 +4270,8 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
+                             {
+ 				ASSERT( aCntntAtPos.aFnd.pFldBookmark!=NULL, "where is my field ptr???");
+ 				if ( aCntntAtPos.aFnd.pFldBookmark!=NULL) {
++				    rView.ExecFieldPopup( aDocPt );
++
+ 				    SwFieldBookmark *fieldBM=const_cast<SwFieldBookmark *>(aCntntAtPos.aFnd.pFldBookmark);
+ 				    fieldBM->SetChecked(!fieldBM->IsChecked());
+ 				    rSh.CalcLayout(); // workaround; is there a better way to update/invalidate???
+diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx
+index f936bc3..a19f836 100644
+--- sw/source/ui/inc/view.hxx
++++ sw/source/ui/inc/view.hxx
+@@ -484,6 +484,7 @@ public:
+ 	DECL_LINK( SpellError, LanguageType * );
+ 	BOOL 			ExecSpellPopup( const Point& rPt );
+ 
++        BOOL            ExecFieldPopup( const Point& rPt );
+     // SMARTTAGS
+     BOOL            ExecSmartTagPopup( const Point& rPt );
+ 
+diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx
+index 957533f..5c8b34b 100644
+--- sw/source/ui/uiview/viewling.cxx
++++ sw/source/ui/uiview/viewling.cxx
+@@ -873,3 +873,128 @@ sal_Bool SwView::ExecSmartTagPopup( const Point& rPt )
+     return bRet;
+ }
+ 
++class SwFieldPopup : public PopupMenu
++{
++public:
++    SwFieldPopup()  {
++	InsertItem(1, ::rtl::OUString::createFromAscii("Hello"));
++    }
++};
++
++class SwFieldListBox : public ListBox
++{
++public:
++    SwFieldListBox(Window* pParent) : ListBox(pParent /*, WB_DROPDOWN*/) {
++    }
++
++protected:
++    virtual void LoseFocus() {
++	printf("ListBox: lose focus!!\n");
++	ListBox::LoseFocus();
++    }    
++
++    virtual void Select() {
++	printf("SELECT!!! IsTravelSelect=%i\n", IsTravelSelect());
++	ListBox::Select();
++    }
++};
++
++class SwFieldDialog : public Dialog
++{
++private:
++    SwFieldListBox aListBox;
++    Edit aText;
++
++    DECL_LINK( MyListBoxHandler, ListBox * );
++
++public:
++    SwFieldDialog(Window* parent) : Dialog(parent, WB_BORDER | WB_SYSTEMWINDOW | WB_NOSHADOW ), aListBox(this), aText(this, WB_RIGHT | WB_READONLY) {
++
++	aListBox.InsertEntry(::rtl::OUString::createFromAscii("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXY"));
++	aListBox.InsertEntry(::rtl::OUString::createFromAscii("Hello"));
++	aListBox.InsertEntry(::rtl::OUString::createFromAscii("World"));
++	aListBox.InsertEntry(::rtl::OUString::createFromAscii("Red"));
++	aListBox.InsertEntry(::rtl::OUString::createFromAscii("Green"));
++	aListBox.InsertEntry(::rtl::OUString::createFromAscii("Blue"));
++	aListBox.InsertEntry(::rtl::OUString::createFromAscii("Pink"));
++	aListBox.InsertEntry(::rtl::OUString::createFromAscii("Orange"));
++//	aListBox.SetPosPixel(Size(0, 0));
++	Size lbSize=aListBox.GetOptimalSize(WINDOWSIZE_PREFERRED);
++	aListBox.SetSizePixel(lbSize);
++	aListBox.SetSelectHdl( LINK( this, SwFieldDialog, MyListBoxHandler ) );
++	aListBox.Show();
++	aText.SetText(rtl::OUString::createFromAscii("Cancel"));
++	Size tSize=aText.GetOptimalSize(WINDOWSIZE_PREFERRED);
++	aText.SetSizePixel(Size(lbSize.Width(), tSize.Height()));
++	aText.SetPosPixel(Point(0, lbSize.Height()));     	
++	aText.Show();
++	SetSizePixel(Size(lbSize.Width(), lbSize.Height()+tSize.Height()));	
++//	SetSizePixel(Size(200, 200));
++    }
++
++protected:
++    /*
++    virtual void LoseFocus() {
++	printf("lose focus!!\n");
++	Dialog::LoseFocus();
++	printf("close:\n");
++	EndDialog(8);
++    }
++    */
++
++    virtual long PreNotify( NotifyEvent& rNEvt ) {
++	if (rNEvt.GetType() == EVENT_LOSEFOCUS && aListBox.GetImplWin()==rNEvt.GetWindow()) {
++	    EndDialog(8);
++	    return 1;	   
++	}
++	if (rNEvt.GetType() == EVENT_KEYINPUT) {
++	    printf("PreNotify::KEYINPUT\n");
++	}
++	return Dialog::PreNotify(rNEvt);
++    }
++};
++
++IMPL_LINK( SwFieldDialog, MyListBoxHandler, ListBox *, pBox )
++{
++    printf("### DROP DOWN SELECT... IsTravelSelect=%i\n", pBox->IsTravelSelect());
++    if (pBox->IsTravelSelect()) {
++	return 0;
++    } else {
++	EndDialog(9);
++	return 1;
++    }
++}
++
++
++BOOL SwView::ExecFieldPopup( const Point& rPt )
++{
++    sal_Bool bRet = sal_False;
++    const sal_Bool bOldViewLock = pWrtShell->IsViewLocked();
++    pWrtShell->LockView( sal_True );
++    pWrtShell->Push();
++
++    {
++	bRet=sal_True;
++	const Point aPixPos = GetEditWin().LogicToPixel( rPt );
++	printf("<execute>\n");	
++/*
++        SwFieldPopup aPopup;
++        aPopup.Execute( pEditWin, aPixPos );
++*/
++	SwFieldDialog aFldDlg(pEditWin);
++//	aFldDlg.SetPosPixel(pEditWin->OutputToScreenPixel(rPt));
++	aFldDlg.SetPosPixel(aPixPos);
++	printf("rPt.X=%li rPt.Y=%li\n", rPt.X(), rPt.Y());
++//	aFldDlg.SetPosPixel(Point(0,0));
++
++	short ret=aFldDlg.Execute();
++	printf("<ret value=\"%i\">\n", (int)ret);
++
++	printf("</execute>\n");
++    }
++
++    pWrtShell->Pop( sal_False );
++    pWrtShell->LockView( bOldViewLock );
++
++    return bRet;
++}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]