summaryrefslogtreecommitdiff
path: root/sw/source/ui/uiview/viewling.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/uiview/viewling.cxx')
-rwxr-xr-xsw/source/ui/uiview/viewling.cxx129
1 files changed, 12 insertions, 117 deletions
diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx
index b05ca41d8e..1ff2555926 100755
--- a/sw/source/ui/uiview/viewling.cxx
+++ b/sw/source/ui/uiview/viewling.cxx
@@ -844,120 +844,6 @@ sal_Bool SwView::ExecSmartTagPopup( const Point& rPt )
return bRet;
}
-class SwFieldDialog : public Dialog
-{
-private:
- SwFieldListBox aListBox;
- Edit aText;
- int selection;
-
- DECL_LINK( MyListBoxHandler, ListBox * );
-
-public:
- SwFieldDialog(Window* parent, IFieldmark *fieldBM) : Dialog(parent, WB_BORDER | WB_SYSTEMWINDOW | WB_NOSHADOW ), aListBox(this), aText(this, WB_RIGHT | WB_READONLY), selection(-1) {
-
- assert(fieldBM!=NULL);
- if (fieldBM!=NULL) {
- const IFieldmark::parameter_map_t* const pParameters = fieldBM->GetParameters();
- IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN_LISTENTRY));
- if(pListEntries != pParameters->end())
- {
- Sequence< ::rtl::OUString> vListEntries;
- pListEntries->second >>= vListEntries;
- for( ::rtl::OUString* pCurrent = vListEntries.getArray();
- pCurrent != vListEntries.getArray() + vListEntries.getLength();
- ++pCurrent)
- {
- aListBox.InsertEntry(*pCurrent);
- }
- }
- }
- Size lbSize=aListBox.GetOptimalSize(WINDOWSIZE_PREFERRED);
- lbSize.Width()+=50;
- lbSize.Height()+=20;
- 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));
- }
-
- int getSelection() {
- return selection;
- }
-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 {
- this->selection=pBox->GetSelectEntryPos();
- EndDialog(9); //@TODO have meaningfull returns...
- return 1;
- }
-}
-
-
-BOOL SwView::ExecFieldPopup( const Point& rPt, IFieldmark *fieldBM )
-{
- 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 );
-
- SwFieldDialog aFldDlg(pEditWin, fieldBM);
- aFldDlg.SetPosPixel(pEditWin->OutputToScreenPixel(aPixPos));
-
- /*short ret=*/aFldDlg.Execute();
- sal_Int32 selection=aFldDlg.getSelection();
- if (selection>=0) {
- (*fieldBM->GetParameters())[::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN_RESULT)] = makeAny(selection);
- }
-
- pWrtShell->Pop( sal_False );
- pWrtShell->LockView( bOldViewLock );
-
- return bRet;
-}
-
-class SwFieldPopup : public PopupMenu
-{
-public:
- SwFieldPopup() {
- InsertItem(1, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hello")));
- }
-};
-
class SwFieldListBox : public ListBox
{
public:
@@ -994,7 +880,7 @@ public:
assert(fieldBM!=NULL);
if (fieldBM!=NULL) {
const IFieldmark::parameter_map_t* const pParameters = fieldBM->GetParameters();
- IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_FORMDROPDOWN_LISTENTRY)));
+ IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN_LISTENTRY));
if(pListEntries != pParameters->end())
{
Sequence< ::rtl::OUString> vListEntries;
@@ -1013,7 +899,7 @@ public:
aListBox.SetSizePixel(lbSize);
aListBox.SetSelectHdl( LINK( this, SwFieldDialog, MyListBoxHandler ) );
aListBox.Show();
- aText.SetText(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cancel")));
+ 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()));
@@ -1049,6 +935,7 @@ IMPL_LINK( SwFieldDialog, MyListBoxHandler, ListBox *, pBox )
}
}
+
BOOL SwView::ExecFieldPopup( const Point& rPt, IFieldmark *fieldBM )
{
sal_Bool bRet = sal_False;
@@ -1065,7 +952,7 @@ BOOL SwView::ExecFieldPopup( const Point& rPt, IFieldmark *fieldBM )
/*short ret=*/aFldDlg.Execute();
sal_Int32 selection=aFldDlg.getSelection();
if (selection>=0) {
- (*fieldBM->GetParameters())[::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODF_FORMDROPDOWN_RESULT))] = makeAny(selection);
+ (*fieldBM->GetParameters())[::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN_RESULT)] = makeAny(selection);
}
pWrtShell->Pop( sal_False );
@@ -1074,4 +961,12 @@ BOOL SwView::ExecFieldPopup( const Point& rPt, IFieldmark *fieldBM )
return bRet;
}
+class SwFieldPopup : public PopupMenu
+{
+public:
+ SwFieldPopup() {
+ InsertItem(1, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hello")));
+ }
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */