summaryrefslogtreecommitdiff
path: root/sw/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui')
-rw-r--r--sw/source/ui/app/appenv.cxx4
-rw-r--r--sw/source/ui/app/apphdl.cxx27
-rw-r--r--sw/source/ui/app/applab.cxx35
-rw-r--r--sw/source/ui/app/docsh.cxx24
-rw-r--r--sw/source/ui/app/docsh2.cxx22
-rw-r--r--sw/source/ui/app/docshini.cxx24
-rw-r--r--sw/source/ui/app/docst.cxx16
-rw-r--r--sw/source/ui/app/makefile.mk1
-rw-r--r--sw/source/ui/app/mn.src7
-rw-r--r--sw/source/ui/app/swmodul1.cxx2
-rw-r--r--sw/source/ui/app/swwait.cxx8
-rw-r--r--sw/source/ui/chrdlg/chardlg.cxx4
-rwxr-xr-x[-rw-r--r--]sw/source/ui/config/optdlg.src6
-rw-r--r--sw/source/ui/dbui/addresslistdialog.cxx2
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx23
-rw-r--r--sw/source/ui/dbui/dbui.src2
-rw-r--r--sw/source/ui/dbui/mailmergewizard.cxx2
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx10
-rw-r--r--sw/source/ui/dialog/macassgn.cxx2
-rw-r--r--sw/source/ui/dialog/makefile.mk4
-rw-r--r--sw/source/ui/dialog/regionsw.cxx14
-rw-r--r--sw/source/ui/dialog/swdlgfact.cxx5
-rw-r--r--sw/source/ui/dialog/swdlgfact.hxx2
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx314
-rw-r--r--sw/source/ui/dochdl/swdtflvr.cxx15
-rw-r--r--sw/source/ui/docvw/AnchorOverlayObject.cxx467
-rw-r--r--sw/source/ui/docvw/AnchorOverlayObject.hxx143
-rw-r--r--sw/source/ui/docvw/AnnotationMenuButton.cxx222
-rw-r--r--sw/source/ui/docvw/AnnotationMenuButton.hxx63
-rw-r--r--sw/source/ui/docvw/AnnotationWin.cxx292
-rw-r--r--sw/source/ui/docvw/PostItMgr.cxx583
-rw-r--r--sw/source/ui/docvw/ShadowOverlayObject.cxx268
-rw-r--r--sw/source/ui/docvw/ShadowOverlayObject.hxx80
-rw-r--r--sw/source/ui/docvw/SidebarTxtControl.cxx422
-rw-r--r--sw/source/ui/docvw/SidebarTxtControl.hxx87
-rw-r--r--sw/source/ui/docvw/SidebarTxtControlAcc.cxx317
-rw-r--r--sw/source/ui/docvw/SidebarTxtControlAcc.hxx (renamed from sw/source/ui/inc/tbxmgr.hxx)50
-rw-r--r--sw/source/ui/docvw/SidebarWin.cxx1373
-rw-r--r--sw/source/ui/docvw/SidebarWinAcc.cxx162
-rw-r--r--sw/source/ui/docvw/SidebarWinAcc.hxx67
-rw-r--r--sw/source/ui/docvw/access.src16
-rw-r--r--sw/source/ui/docvw/annotation.hrc54
-rw-r--r--sw/source/ui/docvw/annotation.src68
-rw-r--r--sw/source/ui/docvw/docvw.hrc13
-rw-r--r--sw/source/ui/docvw/docvw.src41
-rw-r--r--sw/source/ui/docvw/edtdd.cxx2
-rw-r--r--sw/source/ui/docvw/edtwin.cxx38
-rw-r--r--sw/source/ui/docvw/edtwin2.cxx1
-rw-r--r--sw/source/ui/docvw/frmsidebarwincontainer.cxx216
-rw-r--r--sw/source/ui/docvw/frmsidebarwincontainer.hxx73
-rw-r--r--sw/source/ui/docvw/makefile.mk15
-rw-r--r--sw/source/ui/docvw/postit.cxx2483
-rw-r--r--sw/source/ui/docvw/romenu.cxx4
-rw-r--r--sw/source/ui/envelp/mailmrge.cxx6
-rw-r--r--sw/source/ui/fldui/fldedt.cxx2
-rw-r--r--sw/source/ui/fmtui/tmpdlg.cxx2
-rw-r--r--sw/source/ui/frmdlg/column.cxx3
-rw-r--r--sw/source/ui/frmdlg/frmdlg.cxx2
-rw-r--r--sw/source/ui/inc/SidebarWindowsConsts.hxx41
-rw-r--r--sw/source/ui/inc/regionsw.hxx89
-rw-r--r--sw/source/ui/inc/swmn_tmpl.hrc1
-rw-r--r--sw/source/ui/inc/wrtsh.hxx4
-rw-r--r--sw/source/ui/lingu/olmenu.cxx20
-rw-r--r--sw/source/ui/makefile.mk4
-rw-r--r--sw/source/ui/misc/glossary.cxx2
-rw-r--r--sw/source/ui/misc/glshell.cxx4
-rw-r--r--sw/source/ui/misc/insfnote.cxx2
-rw-r--r--sw/source/ui/misc/srtdlg.cxx2
-rw-r--r--sw/source/ui/ribbar/tblctrl.cxx1
-rw-r--r--sw/source/ui/ribbar/tbxmgr.cxx180
-rw-r--r--sw/source/ui/ribbar/workctrl.cxx1
-rwxr-xr-xsw/source/ui/shells/annotsh.cxx114
-rw-r--r--sw/source/ui/shells/basesh.cxx8
-rw-r--r--sw/source/ui/shells/drwtxtsh.cxx2
-rw-r--r--sw/source/ui/shells/frmsh.cxx2
-rw-r--r--sw/source/ui/shells/grfsh.cxx2
-rw-r--r--sw/source/ui/shells/grfshex.cxx2
-rw-r--r--sw/source/ui/shells/makefile.mk1
-rw-r--r--sw/source/ui/shells/tabsh.cxx2
-rw-r--r--sw/source/ui/shells/textdrw.cxx1
-rw-r--r--sw/source/ui/shells/textfld.cxx19
-rw-r--r--sw/source/ui/shells/textsh.cxx2
-rw-r--r--sw/source/ui/shells/txtattr.cxx2
-rw-r--r--sw/source/ui/uiview/pview.cxx26
-rw-r--r--sw/source/ui/uiview/srcview.cxx4
-rw-r--r--sw/source/ui/uiview/view.cxx38
-rw-r--r--sw/source/ui/uiview/view2.cxx17
-rw-r--r--sw/source/ui/uiview/viewdraw.cxx4
-rw-r--r--sw/source/ui/uiview/viewling.cxx5
-rw-r--r--sw/source/ui/uiview/viewmdi.cxx25
-rw-r--r--sw/source/ui/uiview/viewport.cxx8
-rw-r--r--sw/source/ui/uiview/viewsrch.cxx2
-rw-r--r--sw/source/ui/uiview/viewtab.cxx7
-rw-r--r--sw/source/ui/uno/unodispatch.cxx3
-rw-r--r--sw/source/ui/uno/unodoc.cxx4
-rw-r--r--sw/source/ui/uno/unomailmerge.cxx4
-rwxr-xr-x[-rw-r--r--]sw/source/ui/uno/unotxdoc.cxx73
-rw-r--r--sw/source/ui/uno/unotxvw.cxx29
-rw-r--r--sw/source/ui/utlui/attrdesc.cxx6
-rw-r--r--sw/source/ui/utlui/attrdesc.hrc6
-rw-r--r--sw/source/ui/utlui/attrdesc.src6
-rw-r--r--sw/source/ui/utlui/content.cxx12
-rw-r--r--sw/source/ui/utlui/glbltree.cxx36
-rw-r--r--sw/source/ui/utlui/navipi.cxx2
-rw-r--r--sw/source/ui/utlui/numfmtlb.cxx2
-rw-r--r--sw/source/ui/utlui/uitool.cxx2
-rw-r--r--sw/source/ui/vba/vbafind.cxx4
-rw-r--r--sw/source/ui/vba/vbafind.hxx2
-rw-r--r--sw/source/ui/vba/vbaheaderfooterhelper.cxx3
-rw-r--r--sw/source/ui/vba/vbaheaderfooterhelper.hxx2
-rw-r--r--sw/source/ui/vba/vbarange.cxx4
-rw-r--r--sw/source/ui/vba/vbarange.hxx2
-rw-r--r--sw/source/ui/vba/vbasystem.cxx5
-rw-r--r--sw/source/ui/vba/vbasystem.hxx1
-rw-r--r--sw/source/ui/vba/vbawindow.cxx5
-rw-r--r--sw/source/ui/vba/vbawindow.hxx1
-rw-r--r--sw/source/ui/vba/vbawrapformat.cxx5
-rw-r--r--sw/source/ui/vba/vbawrapformat.hxx1
-rw-r--r--sw/source/ui/wrtsh/wrtsh1.cxx17
-rw-r--r--sw/source/ui/wrtsh/wrtsh2.cxx10
120 files changed, 5480 insertions, 3621 deletions
diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx
index a35bc90f38f0..ce06c22cfc88 100644
--- a/sw/source/ui/app/appenv.cxx
+++ b/sw/source/ui/app/appenv.cxx
@@ -191,7 +191,7 @@ static USHORT nTitleNo = 0;
// Neues Dokument erzeugen (kein Show!)
SfxObjectShellRef xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD ) );
xDocSh->DoInitNew( 0 );
- pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE );
+ pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
pNewView = (SwView*) pFrame->GetViewShell();
pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird.
pSh = pNewView->GetWrtShellPtr();
@@ -501,7 +501,7 @@ static USHORT nTitleNo = 0;
if (nMode == ENV_NEWDOC)
{
- pFrame->GetFrame()->Appear();
+ pFrame->GetFrame().Appear();
if ( rItem.aAddrText.indexOf('<') >= 0 )
{
diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx
index accb052033f6..8d8fc095b5be 100644
--- a/sw/source/ui/app/apphdl.cxx
+++ b/sw/source/ui/app/apphdl.cxx
@@ -240,7 +240,7 @@ SwView* lcl_LoadDoc(SwView* pView, const String& rURL)
if( pViewShell->ISA(SwView) )
{
pNewView = PTR_CAST(SwView,pViewShell);
- pNewView->GetViewFrame()->GetFrame()->Appear();
+ pNewView->GetViewFrame()->GetFrame().Appear();
}
else
{
@@ -474,7 +474,7 @@ IMPL_LINK( SwMailMergeWizardExecutor, EndDialogHdl, AbstractMailMergeWizard*, EM
{
SwView* pTargetView = m_pMMConfig->GetTargetView();
uno::Reference< frame::XFrame > xFrame =
- m_pView->GetViewFrame()->GetFrame()->GetFrameInterface();
+ m_pView->GetViewFrame()->GetFrame().GetFrameInterface();
xFrame->getContainerWindow()->setVisible(sal_False);
DBG_ASSERT(pTargetView, "No target view has been created");
if(pTargetView)
@@ -520,7 +520,7 @@ IMPL_LINK( SwMailMergeWizardExecutor, EndDialogHdl, AbstractMailMergeWizard*, EM
{
m_pView2Close = pTargetView;
pTargetView->GetViewFrame()->GetTopViewFrame()->GetWindow().Hide();
- pSourceView->GetViewFrame()->GetFrame()->AppearWithUpdate();
+ pSourceView->GetViewFrame()->GetFrame().AppearWithUpdate();
// the current view has be be set when the target is destroyed
m_pView = pSourceView;
m_pMMConfig->SetTargetView(0);
@@ -559,7 +559,7 @@ IMPL_LINK( SwMailMergeWizardExecutor, EndDialogHdl, AbstractMailMergeWizard*, EM
if(pDocShell->HasName() && !pDocShell->IsModified())
m_pMMConfig->GetSourceView()->GetViewFrame()->DoClose();
else
- m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame()->Appear();
+ m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame().Appear();
}
ExecutionFinished( true );
break;
@@ -593,7 +593,7 @@ IMPL_LINK( SwMailMergeWizardExecutor, CancelHdl, AbstractMailMergeWizard*, EMPTY
m_pMMConfig->SetTargetView(0);
}
if(m_pMMConfig->GetSourceView())
- m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame()->AppearWithUpdate();
+ m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame().AppearWithUpdate();
m_pMMConfig->Commit();
delete m_pMMConfig;
@@ -959,21 +959,8 @@ void NewXForms( SfxRequest& rReq )
// initialize XForms
static_cast<SwDocShell*>( &xDocSh )->GetDoc()->initXForms( true );
- // put document into frame
- const SfxItemSet* pArgs = rReq.GetArgs();
- DBG_ASSERT( pArgs, "no arguments in SfxRequest");
- if( pArgs != NULL )
- {
- const SfxPoolItem* pFrameItem = NULL;
- pArgs->GetItemState( SID_DOCFRAME, FALSE, &pFrameItem );
- if( pFrameItem != NULL )
- {
- SfxFrame* pFrame =
- static_cast<const SfxFrameItem*>( pFrameItem )->GetFrame();
- DBG_ASSERT( pFrame != NULL, "no frame?" );
- pFrame->InsertDocument( xDocSh );
- }
- }
+ // load document into frame
+ SfxViewFrame::DisplayNewDocument( *xDocSh, rReq );
// set return value
rReq.SetReturnValue( SfxVoidItem( rReq.GetSlot() ) );
diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx
index 7ff62b4a0c1b..41f055f86050 100644
--- a/sw/source/ui/app/applab.cxx
+++ b/sw/source/ui/app/applab.cxx
@@ -220,25 +220,9 @@ static sal_uInt16 nBCTitleNo = 0;
pDocSh->getIDocumentDeviceAccess()->setJobsetup(pPrt->GetJobSetup());
}
- const SfxItemSet *pArgs = rReq.GetArgs();
- DBG_ASSERT( pArgs, "no arguments in SfxRequest");
- const SfxPoolItem* pFrameItem = 0;
- if(pArgs)
- pArgs->GetItemState(SID_DOCFRAME, FALSE, &pFrameItem);
-
- SfxViewFrame* pFrame = 0;
- if( pFrameItem )
- {
- SfxFrame* pFr = ((const SfxFrameItem*)pFrameItem)->GetFrame();
- xDocSh->PutItem(SfxBoolItem(SID_HIDDEN, TRUE));
- pFr->InsertDocument(xDocSh);
- pFrame = pFr->GetCurrentViewFrame();
- }
- else
- {
- pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE );
- }
- SwView *pNewView = (SwView*) pFrame->GetViewShell();
+ SfxViewFrame* pViewFrame = SfxViewFrame::DisplayNewDocument( *xDocSh, rReq );
+
+ SwView *pNewView = (SwView*) pViewFrame->GetViewShell();
pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird.
// Dokumenttitel setzen
@@ -255,7 +239,7 @@ static sal_uInt16 nBCTitleNo = 0;
}
xDocSh->SetTitle( aTmp );
- pFrame->GetFrame()->Appear();
+ pViewFrame->GetFrame().Appear();
// Shell ermitteln
SwWrtShell *pSh = pNewView->GetWrtShellPtr();
@@ -394,19 +378,20 @@ static sal_uInt16 nBCTitleNo = 0;
else
pSh->SetMark(); // set only the mark
- SwSection aSect( CONTENT_SECTION,
- String::CreateFromAscii(MASTER_LABEL));
+ SwSectionData aSect(CONTENT_SECTION,
+ String::CreateFromAscii(MASTER_LABEL));
pSh->InsertSection(aSect);
}
}
else if (rItem.bSynchron)
{
- SwSection aSect(FILE_LINK_SECTION, pSh->GetUniqueSectionName());
+ SwSectionData aSect(FILE_LINK_SECTION,
+ pSh->GetUniqueSectionName());
String sLinkName(sfx2::cTokenSeperator);
sLinkName += sfx2::cTokenSeperator;
sLinkName += String::CreateFromAscii(MASTER_LABEL);
aSect.SetLinkFileName(sLinkName);
- aSect.SetProtect();
+ aSect.SetProtectFlag(true);
pSh->Insert(aDotStr); // Dummytext zum Zuweisen der Section
pSh->SttDoc();
pSh->EndDoc(sal_True); // Alles im Rahmen selektieren
@@ -457,7 +442,7 @@ static sal_uInt16 nBCTitleNo = 0;
if( rItem.bSynchron )
{
- SfxDispatcher* pDisp = pFrame->GetDispatcher();
+ SfxDispatcher* pDisp = pViewFrame->GetDispatcher();
ASSERT(pDisp, "Heute kein Dispatcher am Frame?");
pDisp->Execute(FN_SYNC_LABELS, SFX_CALLMODE_ASYNCHRON);
}
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx
index 3759f3a9cd89..34ccac06a256 100644
--- a/sw/source/ui/app/docsh.cxx
+++ b/sw/source/ui/app/docsh.cxx
@@ -69,7 +69,6 @@
#include <view.hxx> // fuer die aktuelle Sicht
#include <edtwin.hxx>
#include <PostItMgr.hxx>
-#include <postit.hxx>
#include <wrtsh.hxx> // Verbindung zur Core
#include <docsh.hxx> // Dokumenterzeugung
#include <basesh.hxx>
@@ -429,8 +428,12 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium )
pView->GetEditWin().StopQuickHelp();
//#i91811# mod if we have an active margin window, write back the text
- if (pView && pView->GetPostItMgr() && pView->GetPostItMgr()->GetActivePostIt())
- pView->GetPostItMgr()->GetActivePostIt()->UpdateData();
+ if ( pView &&
+ pView->GetPostItMgr() &&
+ pView->GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ pView->GetPostItMgr()->UpdateDataOnActiveSidebarWin();
+ }
if( pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) &&
!pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS) )
@@ -575,8 +578,12 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium )
pView->GetEditWin().StopQuickHelp();
//#i91811# mod if we have an active margin window, write back the text
- if (pView && pView->GetPostItMgr() && pView->GetPostItMgr()->GetActivePostIt())
- pView->GetPostItMgr()->GetActivePostIt()->UpdateData();
+ if ( pView &&
+ pView->GetPostItMgr() &&
+ pView->GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ pView->GetPostItMgr()->UpdateDataOnActiveSidebarWin();
+ }
ULONG nVBWarning = 0;
@@ -763,6 +770,10 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium )
if ( pWrtShell )
{
SwWait aWait( *this, TRUE );
+ // --> OD 2009-12-31 #i106906#
+ const sal_Bool bFormerLockView = pWrtShell->IsViewLocked();
+ pWrtShell->LockView( sal_True );
+ // <--
pWrtShell->StartAllAction();
pWrtShell->Push();
SwWriter aWrt( rMedium, *pWrtShell, TRUE );
@@ -773,6 +784,9 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium )
{
pWrtShell->Pop(FALSE);
pWrtShell->EndAllAction();
+ // --> OD 2009-12-31 #i106906#
+ pWrtShell->LockView( bFormerLockView );
+ // <--
}
}
else
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
index cb8931b0a055..9cb3caffa7cc 100644
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -676,7 +676,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
bOnly = FALSE;
else if( IS_TYPE( SwPagePreView, pTmpFrm->GetViewShell()))
{
- pTmpFrm->GetFrame()->Appear();
+ pTmpFrm->GetFrame().Appear();
bFound = TRUE;
}
if( bFound && !bOnly )
@@ -1027,7 +1027,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
else
{
// Neues Dokument erzeugen.
- SfxViewFrame *pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0 );
+ SfxViewFrame *pFrame = SfxViewFrame::LoadDocument( *xDocSh, 0 );
SwView *pCurrView = (SwView*) pFrame->GetViewShell();
// Dokumenttitel setzen
@@ -1169,18 +1169,6 @@ void SwDocShell::Execute(SfxRequest& rReq)
}
break;
- case SID_MAIL_PREPAREEXPORT:
- {
- //pWrtShell is not set in page preview
- if(pWrtShell)
- pWrtShell->StartAllAction();
- pDoc->UpdateFlds( NULL, false );
- pDoc->EmbedAllLinks();
- pDoc->RemoveInvisibleContent();
- if(pWrtShell)
- pWrtShell->EndAllAction();
- }
- break;
case SID_MAIL_EXPORT_FINISHED:
{
if(pWrtShell)
@@ -1766,15 +1754,15 @@ void SwDocShell::ToggleBrowserMode(BOOL bSet, SwView* _pView )
// Currently there can be only one view (layout) if the document is viewed in Web layout
// So if there are more views we are in print layout and for toggling to Web layout all other views must be closed
- SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, 0, FALSE);
+ SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, FALSE);
do {
if( pTmpFrm != pTempView->GetViewFrame() )
{
pTmpFrm->DoClose();
- pTmpFrm = SfxViewFrame::GetFirst(this, 0, FALSE);
+ pTmpFrm = SfxViewFrame::GetFirst(this, FALSE);
}
else
- pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this, 0, FALSE);
+ pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this, FALSE);
} while ( pTmpFrm );
diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx
index 8ed82a935a4d..c201109ca1cb 100644
--- a/sw/source/ui/app/docshini.cxx
+++ b/sw/source/ui/app/docshini.cxx
@@ -39,6 +39,7 @@
#include <svtools/ctrltool.hxx>
#include <unotools/lingucfg.hxx>
#include <sfx2/docfile.hxx>
+#include <sfx2/sfxmodelfactory.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/bindings.hxx>
#include <svl/asiancfg.hxx>
@@ -371,7 +372,7 @@ sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
--------------------------------------------------------------------*/
-SwDocShell::SwDocShell( SfxObjectCreateMode eMode, sal_Bool _bScriptingSupport ) :
+SwDocShell::SwDocShell( SfxObjectCreateMode eMode ) :
SfxObjectShell ( eMode ),
pDoc(0),
pFontList(0),
@@ -382,8 +383,25 @@ SwDocShell::SwDocShell( SfxObjectCreateMode eMode, sal_Bool _bScriptingSupport )
bInUpdateFontList(false)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" );
- if ( !_bScriptingSupport )
- SetHasNoBasic();
+ Init_Impl();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ctor / Dtor
+ --------------------------------------------------------------------*/
+
+
+SwDocShell::SwDocShell( const sal_uInt64 i_nSfxCreationFlags ) :
+ SfxObjectShell ( i_nSfxCreationFlags ),
+ pDoc(0),
+ pFontList(0),
+ pView( 0 ),
+ pWrtShell( 0 ),
+ pOLEChildList( 0 ),
+ nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG),
+ bInUpdateFontList(false)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" );
Init_Impl();
}
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
index 0cf03f803ad3..d06ab31b7478 100644
--- a/sw/source/ui/app/docst.cxx
+++ b/sw/source/ui/app/docst.cxx
@@ -1017,18 +1017,10 @@ USHORT SwDocShell::UpdateStyle(const String &rName, USHORT nFamily, SwWrtShell*
pCurrWrtShell->StartAllAction();
pCurrWrtShell->GetFlyFrmAttr( aSet );
- // JP 10.06.98: nur automatische Orientierungen uebernehmen
-/* #61359# jetzt auch wieder alle Orientierungen
- * const SfxPoolItem* pItem;
- if( SFX_ITEM_SET == aSet.GetItemState( RES_VERT_ORIENT,
- FALSE, &pItem ) &&
- text::VertOrientation::NONE == ((SwFmtVertOrient*)pItem)->GetVertOrient())
- aSet.ClearItem( RES_VERT_ORIENT );
-
- if( SFX_ITEM_SET == aSet.GetItemState( RES_HORI_ORIENT,
- FALSE, &pItem ) &&
- text::HoriOrientation::NONE == ((SwFmtHoriOrient*)pItem)->GetHoriOrient())
- aSet.ClearItem( RES_HORI_ORIENT );*/
+ // --> OD 2009-12-28 #i105535#
+ // no update of anchor attribute
+ aSet.ClearItem( RES_ANCHOR );
+ // <--
pFrm->SetFmtAttr( aSet );
diff --git a/sw/source/ui/app/makefile.mk b/sw/source/ui/app/makefile.mk
index 943f1004eb74..88f9ff9d6398 100644
--- a/sw/source/ui/app/makefile.mk
+++ b/sw/source/ui/app/makefile.mk
@@ -69,6 +69,7 @@ SLOFILES = \
EXCEPTIONSFILES= \
$(SLO)$/docsh.obj \
$(SLO)$/docst.obj \
+ $(SLO)$/docshini.obj \
$(SLO)$/swmodule.obj \
$(SLO)$/swmodul1.obj \
$(SLO)$/apphdl.obj \
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
index 81dad77566b2..16e20f5725a2 100644
--- a/sw/source/ui/app/mn.src
+++ b/sw/source/ui/app/mn.src
@@ -597,6 +597,7 @@ Menu MN_TAB_POPUPMENU
MN_EDIT_CONTOUR\
MenuItem\
{\
+ Checkable = TRUE ; \
Identifier = FN_WRAP_ANCHOR_ONLY ; \
HelpID = FN_WRAP_ANCHOR_ONLY ; \
Text [ en-US ] = "~First Paragraph" ; \
@@ -661,6 +662,7 @@ String MN_DRAW_POPUPMENU
MN_WRAP_CONTOUR_1\
MenuItem\
{\
+ Checkable = TRUE ; \
Identifier = FN_WRAP_ANCHOR_ONLY ; \
HelpID = FN_WRAP_ANCHOR_ONLY ; \
Text [ en-US ] = "~First Paragraph" ; \
@@ -686,6 +688,7 @@ String MN_DRAW_POPUPMENU
#define MN_AT_FRAME \
MenuItem\
{\
+ RadioCheck = TRUE ; \
Identifier = FN_TOOL_ANKER_FRAME ; \
HelpID = FN_TOOL_ANKER_FRAME ; \
Text [ en-US ] = "To ~Frame" ; \
@@ -704,24 +707,28 @@ String MN_DRAW_POPUPMENU
{\
MenuItem\
{\
+ RadioCheck = TRUE ; \
Identifier = FN_TOOL_ANKER_PAGE ; \
HelpID = FN_TOOL_ANKER_PAGE ; \
Text [ en-US ] = "To P~age" ; \
};\
MenuItem\
{\
+ RadioCheck = TRUE ; \
Identifier = FN_TOOL_ANKER_PARAGRAPH ; \
HelpID = FN_TOOL_ANKER_PARAGRAPH ; \
Text [ en-US ] = "To ~Paragraph" ; \
};\
MenuItem\
{\
+ RadioCheck = TRUE ; \
Identifier = FN_TOOL_ANKER_AT_CHAR ; \
HelpID = FN_TOOL_ANKER_AT_CHAR ; \
Text [ en-US ] = "To ~Character" ; \
};\
MenuItem\
{\
+ RadioCheck = TRUE ; \
Identifier = FN_TOOL_ANKER_CHAR ; \
HelpID = FN_TOOL_ANKER_CHAR ; \
Text [ en-US ] = "As C~haracter" ; \
diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx
index 97c34c573756..2b3a5df1391b 100644
--- a/sw/source/ui/app/swmodul1.cxx
+++ b/sw/source/ui/app/swmodul1.cxx
@@ -355,7 +355,7 @@ SwChapterNumRules* SwModule::GetChapterNumRules()
void SwModule::ShowDBObj(SwView& rView, const SwDBData& rData, BOOL /*bOnlyIfAvailable*/)
{
- Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame()->GetFrameInterface();
+ Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface();
Reference<XDispatchProvider> xDP(xFrame, uno::UNO_QUERY);
uno::Reference<frame::XFrame> xBeamerFrame = xFrame->findFrame(
diff --git a/sw/source/ui/app/swwait.cxx b/sw/source/ui/app/swwait.cxx
index 0345cd8a6806..4392bdea04ac 100644
--- a/sw/source/ui/app/swwait.cxx
+++ b/sw/source/ui/app/swwait.cxx
@@ -38,25 +38,25 @@
void SwDocShell::EnterWait( BOOL bLockDispatcher )
{
- SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, 0, FALSE );
+ SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, FALSE );
while ( pFrame )
{
pFrame->GetWindow().EnterWait();
if ( bLockDispatcher )
pFrame->GetDispatcher()->Lock( TRUE );
- pFrame = SfxViewFrame::GetNext( *pFrame, this, 0, FALSE );
+ pFrame = SfxViewFrame::GetNext( *pFrame, this, FALSE );
}
}
void SwDocShell::LeaveWait( BOOL bLockDispatcher )
{
- SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, 0, FALSE );
+ SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, FALSE );
while ( pFrame )
{
pFrame->GetWindow().LeaveWait();
if ( bLockDispatcher )
pFrame->GetDispatcher()->Lock( FALSE );
- pFrame = SfxViewFrame::GetNext( *pFrame, this, 0, FALSE );
+ pFrame = SfxViewFrame::GetNext( *pFrame, this, FALSE );
}
}
diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx
index fdf633a45b8a..38b1ba906fdd 100644
--- a/sw/source/ui/chrdlg/chardlg.cxx
+++ b/sw/source/ui/chrdlg/chardlg.cxx
@@ -241,8 +241,8 @@ SwCharURLPage::SwCharURLPage( Window* pParent,
::FillCharStyleListBox(aNotVisitedLB, pView->GetDocShell());
TargetList* pList = new TargetList;
- const SfxFrame* pFrame = pView->GetViewFrame()->GetTopFrame();
- pFrame->GetTargetList(*pList);
+ const SfxFrame& rFrame = pView->GetViewFrame()->GetTopFrame();
+ rFrame.GetTargetList(*pList);
USHORT nCount = (USHORT)pList->Count();
if( nCount )
{
diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src
index a2b9b4af8a9e..97f903557bda 100644..100755
--- a/sw/source/ui/config/optdlg.src
+++ b/sw/source/ui/config/optdlg.src
@@ -952,11 +952,11 @@ StringArray STR_PRINTOPTUI
< "Contents"; >;
< "Page ba~ckground"; >;
< "Specifies whether to include colors and objects that are inserted to the background of the page (Format - Page - Background) in the printed document."; >;
- < "~Pictures and objects"; >;
+ < "P~ictures and other graphic objects"; >;
< "Specifies whether the graphics and drawing or OLE objects of your text document are printed"; >;
< "Hidden te~xt"; >;
< "Enable this option to print text that is marked as hidden."; >;
- < "~Text placeholder"; >;
+ < "~Text placeholders"; >;
< "Enable this option to print text placeholders. Disable this option to leave the text placeholders blank in the printout."; >;
< "Form control~s"; >;
< "Specifies whether the form control fields of the text document are printed"; >;
@@ -985,7 +985,7 @@ StringArray STR_PRINTOPTUI
< "Select the Brochure option to print the document in brochure format."; >;
< "Left-to-right script"; >;
< "Right-to-left script"; >;
- < "Ranges and copies"; >;
+ < "Range and copies"; >;
< "~All pages"; >;
< "Print the whole document."; >;
< "Pa~ges"; >;
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index 6797a2cedf0e..dc007fc68e13 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -580,7 +580,7 @@ void SwAddressListDialog::DetectTablesAndQueries(
uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
uno::Reference< XInteractionHandler > xHandler(
- xMgr->createInstance( C2U( "com.sun.star.sdb.InteractionHandler" )), UNO_QUERY);
+ xMgr->createInstance( C2U( "com.sun.star.task.InteractionHandler" )), UNO_QUERY);
pUserData->xConnection = SharedConnection( xComplConnection->connectWithCompletion( xHandler ) );
}
if(pUserData->xConnection.is())
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index f449ad816c3e..8ad861713e0a 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -935,7 +935,7 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
// create a target docshell to put the merged document into
xTargetDocShell = new SwDocShell( SFX_CREATE_MODE_STANDARD );
xTargetDocShell->DoInitNew( 0 );
- SfxViewFrame* pTargetFrame = SfxViewFrame::CreateViewFrame( *xTargetDocShell, 0, TRUE );
+ SfxViewFrame* pTargetFrame = SfxViewFrame::LoadHiddenDocument( *xTargetDocShell, 0 );
pTargetView = static_cast<SwView*>( pTargetFrame->GetViewShell() );
@@ -1055,7 +1055,7 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
if (xWorkDocSh->DoLoad(pWorkMed))
{
//create a view frame for the document
- SfxViewFrame* pWorkFrame = SfxViewFrame::CreateViewFrame( *xWorkDocSh, 0, TRUE );
+ SfxViewFrame* pWorkFrame = SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 );
//request the layout calculation
SwWrtShell& rWorkShell =
static_cast< SwView* >(pWorkFrame->GetViewShell())->GetWrtShell();
@@ -1255,6 +1255,9 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
nEndRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0;
} while( !bCancel &&
(bSynchronizedDoc && (nStartRow != nEndRow)? ExistsNextRecord() : ToNextMergeRecord()));
+
+ aPrtMonDlg.Show( FALSE );
+
// save the single output document
if(rMergeDescriptor.bCreateSingleFile || bAsSingleFile)
{
@@ -1613,7 +1616,7 @@ uno::Reference< sdbc::XConnection> SwNewDBMgr::GetConnection(const String& rData
{
rxSource.set(xComplConnection,UNO_QUERY);
Reference< XInteractionHandler > xHandler(
- xMgr->createInstance( C2U( "com.sun.star.sdb.InteractionHandler" )), UNO_QUERY);
+ xMgr->createInstance( C2U( "com.sun.star.task.InteractionHandler" )), UNO_QUERY);
xConnection = xComplConnection->connectWithCompletion( xHandler );
}
}
@@ -2556,7 +2559,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh,
pWorkMed->SetFilter( pSfxFlt );
if( xWorkDocSh->DoLoad(pWorkMed) )
{
- SfxViewFrame *pFrame = SfxViewFrame::CreateViewFrame( *xWorkDocSh, 0, TRUE );
+ SfxViewFrame *pFrame = SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 );
SwView *pView = (SwView*) pFrame->GetViewShell();
pView->AttrChangedNotify( &pView->GetWrtShell() );//Damit SelectShell gerufen wird.
//set the current DBMgr
@@ -2765,7 +2768,7 @@ uno::Reference<XResultSet> SwNewDBMgr::createCursor(const ::rtl::OUString& _sDat
if ( xRowSet.is() )
{
- uno::Reference< XInteractionHandler > xHandler(xMgr->createInstance(C2U("com.sun.star.sdb.InteractionHandler")), UNO_QUERY);
+ uno::Reference< XInteractionHandler > xHandler(xMgr->createInstance(C2U("com.sun.star.task.InteractionHandler")), UNO_QUERY);
xRowSet->executeWithCompletion(xHandler);
}
xResultSet = uno::Reference<XResultSet>(xRowSet, UNO_QUERY);
@@ -2848,14 +2851,14 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
// create a target docshell to put the merged document into
SfxObjectShellRef xTargetDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) );
xTargetDocShell->DoInitNew( 0 );
- SfxViewFrame* pTargetFrame = SfxViewFrame::CreateViewFrame( *xTargetDocShell, 0, TRUE );
+ SfxViewFrame* pTargetFrame = SfxViewFrame::LoadHiddenDocument( *xTargetDocShell, 0 );
//the created window has to be located at the same position as the source window
- Window& rTargetWindow = pTargetFrame->GetFrame()->GetWindow();
- Window& rSourceWindow = rSourceView.GetViewFrame()->GetFrame()->GetWindow();
+ Window& rTargetWindow = pTargetFrame->GetFrame().GetWindow();
+ Window& rSourceWindow = rSourceView.GetViewFrame()->GetFrame().GetWindow();
rTargetWindow.SetPosPixel(rSourceWindow.GetPosPixel());
-// pTargetFrame->GetFrame()->Appear();
+// pTargetFrame->GetFrame().Appear();
SwView* pTargetView = static_cast<SwView*>( pTargetFrame->GetViewShell() );
rMMConfig.SetTargetView(pTargetView);
//initiate SelectShell() to create sub shells
@@ -2909,7 +2912,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
xWorkDocSh->DoInitNew();
}
//create a ViewFrame
- SwView* pWorkView = static_cast< SwView* >( SfxViewFrame::CreateViewFrame( *xWorkDocSh, 0, sal_True )->GetViewShell() );
+ SwView* pWorkView = static_cast< SwView* >( SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 )->GetViewShell() );
SwWrtShell& rWorkShell = pWorkView->GetWrtShell();
pWorkView->AttrChangedNotify( &rWorkShell );//Damit SelectShell gerufen wird.
diff --git a/sw/source/ui/dbui/dbui.src b/sw/source/ui/dbui/dbui.src
index aa84a1b1f997..f0dba28f75cc 100644
--- a/sw/source/ui/dbui/dbui.src
+++ b/sw/source/ui/dbui/dbui.src
@@ -83,7 +83,7 @@ ModelessDialog DLG_PRINTMONITOR
Pos = MAP_APPFONT ( 6, 17 ) ;
Size = MAP_APPFONT ( 100, 8 ) ;
CENTER = TRUE ;
- Text [ en-US ] = "is being printed on" ;
+ Text [ en-US ] = "is being prepared for printing on" ;
};
FixedText FT_SENDING
{
diff --git a/sw/source/ui/dbui/mailmergewizard.cxx b/sw/source/ui/dbui/mailmergewizard.cxx
index e4903ba83134..54cf6edac512 100644
--- a/sw/source/ui/dbui/mailmergewizard.cxx
+++ b/sw/source/ui/dbui/mailmergewizard.cxx
@@ -307,7 +307,7 @@ void SwMailMergeWizard::CreateTargetDocument()
MergeDocuments( m_rConfigItem, *GetSwView() );
m_rConfigItem.SetMergeDone();
if( m_rConfigItem.GetTargetView() )
- m_rConfigItem.GetTargetView()->GetViewFrame()->GetFrame()->Appear();
+ m_rConfigItem.GetTargetView()->GetViewFrame()->GetFrame().Appear();
}
/*-- 23.08.2004 08:51:36---------------------------------------------------
diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx
index a9d1b4a0e2ae..0fe1a3717ca1 100644
--- a/sw/source/ui/dbui/mmoutputpage.cxx
+++ b/sw/source/ui/dbui/mmoutputpage.cxx
@@ -692,7 +692,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveStartHdl_Impl, PushButton*, pButton)
{
SfxViewFrame* pSourceViewFrm = pSourceView->GetViewFrame();
uno::Reference< frame::XFrame > xFrame =
- pSourceViewFrm->GetFrame()->GetFrameInterface();
+ pSourceViewFrm->GetFrame().GetFrameInterface();
xFrame->getContainerWindow()->setVisible(sal_True);
pSourceViewFrm->GetDispatcher()->Execute(SID_SAVEDOC, SFX_CALLMODE_SYNCHRON);
xFrame->getContainerWindow()->setVisible(sal_False);
@@ -855,8 +855,8 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
//now extract a document from the target document
SfxObjectShellRef xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) );
xTempDocShell->DoInitNew( 0 );
- SfxViewFrame* pTempFrame = SfxViewFrame::CreateViewFrame( *xTempDocShell, 0, TRUE );
-// pTempFrame->GetFrame()->Appear();
+ SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 );
+// pTempFrame->GetFrame().Appear();
SwView* pTempView = static_cast<SwView*>( pTempFrame->GetViewShell() );
pTargetView->GetWrtShell().StartAction();
SwgReaderOption aOpt;
@@ -1254,8 +1254,8 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton)
//now extract a document from the target document
SfxObjectShellRef xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) );
xTempDocShell->DoInitNew( 0 );
- SfxViewFrame* pTempFrame = SfxViewFrame::CreateViewFrame( *xTempDocShell, 0, TRUE );
-// pTempFrame->GetFrame()->Appear();
+ SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 );
+// pTempFrame->GetFrame().Appear();
SwView* pTempView = static_cast<SwView*>( pTempFrame->GetViewShell() );
pTargetView->GetWrtShell().StartAction();
SwgReaderOption aOpt;
diff --git a/sw/source/ui/dialog/macassgn.cxx b/sw/source/ui/dialog/macassgn.cxx
index 2f78c22a83ab..2d2b7c357720 100644
--- a/sw/source/ui/dialog/macassgn.cxx
+++ b/sw/source/ui/dialog/macassgn.cxx
@@ -149,7 +149,7 @@ BOOL SwMacroAssignDlg::INetFmtDlg( Window* pParent, SwWrtShell& rSh,
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( pParent, aSet,
- rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(),
+ rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(),
SID_EVENTCONFIG );
if ( pMacroDlg && pMacroDlg->Execute() == RET_OK )
{
diff --git a/sw/source/ui/dialog/makefile.mk b/sw/source/ui/dialog/makefile.mk
index 54b7784946e8..758ea00fcb10 100644
--- a/sw/source/ui/dialog/makefile.mk
+++ b/sw/source/ui/dialog/makefile.mk
@@ -86,11 +86,7 @@ $(INCCOM)$/swuilib.hxx: makefile.mk
$(RM) $@
echo \#define DLL_NAME \"libswui$(DLLPOSTFIX)$(DLLPOST)\" >$@
.ELSE
-.IF "$(USE_SHELL)"!="4nt"
echo \#define DLL_NAME \"swui$(DLLPOSTFIX)$(DLLPOST)\" >$@
-.ELSE # "$(USE_SHELL)"!="4nt"
- echo #define DLL_NAME "swui$(DLLPOSTFIX)$(DLLPOST)" >$@
-.ENDIF # "$(USE_SHELL)"!="4nt"
.ENDIF
$(SLO)$/swabstdlg.obj : $(INCCOM)$/swuilib.hxx
diff --git a/sw/source/ui/dialog/regionsw.cxx b/sw/source/ui/dialog/regionsw.cxx
index ef9e8f4f85de..8a4304bcd5a9 100644
--- a/sw/source/ui/dialog/regionsw.cxx
+++ b/sw/source/ui/dialog/regionsw.cxx
@@ -117,7 +117,7 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq)
else
aTmpStr = rSh.GetUniqueSectionName();
- SwSection aSection(CONTENT_SECTION,aTmpStr);
+ SwSectionData aSection(CONTENT_SECTION, aTmpStr);
rReq.SetReturnValue(SfxStringItem(FN_INSERT_REGION, aTmpStr));
aSet.Put( *pSet );
@@ -153,10 +153,10 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq)
(BOOL)((const SfxBoolItem *)pItem)->GetValue():FALSE;
// <--
- aSection.SetProtect(bProtect);
+ aSection.SetProtectFlag(bProtect);
aSection.SetHidden(bHidden);
// --> FME 2004-06-22 #114856# edit in readonly sections
- aSection.SetEditInReadonly(bEditInReadonly);
+ aSection.SetEditInReadonlyFlag(bEditInReadonly);
// <--
if(SFX_ITEM_SET ==
@@ -193,9 +193,10 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq)
}
}
-IMPL_STATIC_LINK( SwWrtShell, InsertRegionDialog, SwSection*, pSect )
+IMPL_STATIC_LINK( SwWrtShell, InsertRegionDialog, SwSectionData*, pSect )
{
- if( pSect )
+ ::std::auto_ptr<SwSectionData> pSectionData(pSect);
+ if (pSectionData.get())
{
SfxItemSet aSet(pThis->GetView().GetPool(),
RES_COL, RES_COL,
@@ -214,10 +215,9 @@ IMPL_STATIC_LINK( SwWrtShell, InsertRegionDialog, SwSection*, pSect )
AbstractInsertSectionTabDialog* aTabDlg = pFact->CreateInsertSectionTabDialog( DLG_INSERT_SECTION,
&pThis->GetView().GetViewFrame()->GetWindow(),aSet , *pThis);
DBG_ASSERT(aTabDlg, "Dialogdiet fail!");
- aTabDlg->SetSection(*pSect);
+ aTabDlg->SetSectionData(*pSectionData);
aTabDlg->Execute();
- delete pSect;
delete aTabDlg;
}
return 0;
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index bdc3a320dcd6..8447489e5b03 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -566,9 +566,10 @@ void AbstractEditRegionDlg_Impl::SelectSection(const String& rSectionName)
}
// AbstractEditRegionDlg_Impl end
//AbstractInsertSectionTabDialog_Impl begin
-void AbstractInsertSectionTabDialog_Impl::SetSection(const SwSection& rSect)
+void
+AbstractInsertSectionTabDialog_Impl::SetSectionData(SwSectionData const& rSect)
{
- pDlg->SetSection( rSect);
+ pDlg->SetSectionData(rSect);
}
// AbstractInsertSectionTabDialog_Impl end
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 462c571a06fa..5d8611d51f54 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -377,7 +377,7 @@ class SwInsertSectionTabDialog;
class AbstractInsertSectionTabDialog_Impl : public AbstractInsertSectionTabDialog
{
DECL_ABSTDLG_BASE(AbstractInsertSectionTabDialog_Impl,SwInsertSectionTabDialog)
- virtual void SetSection(const SwSection& rSect);
+ virtual void SetSectionData(SwSectionData const& rSect);
};
//for SwInsertSectionTabDialog end
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index c1e6df5edbf5..b4151f6d1462 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -80,13 +80,12 @@
using namespace ::com::sun::star;
+
// sw/inc/docary.hxx
SV_IMPL_PTRARR( SwSectionFmts, SwSectionFmtPtr )
#define FILE_NAME_LENGTH 17
-SV_IMPL_OP_PTRARR_SORT( SectReprArr, SectReprPtr )
-
static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox );
void lcl_FillList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAvailNames, const SwSectionFmt* pNewFmt )
@@ -103,7 +102,8 @@ void lcl_FillList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAvailNames
(eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
&& TOX_HEADER_SECTION != eTmpType )
{
- String* pString = new String(pFmt->GetSection()->GetName());
+ String* pString =
+ new String(pFmt->GetSection()->GetSectionName());
if(pAvailNames)
pAvailNames->InsertEntry(*pString);
rSubRegions.InsertEntry(*pString);
@@ -123,7 +123,8 @@ void lcl_FillList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAvailNames
(eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
&& TOX_HEADER_SECTION != eTmpType )
{
- String* pString = new String(pFmt->GetSection()->GetName());
+ String* pString =
+ new String(pFmt->GetSection()->GetSectionName());
if(pAvailNames)
pAvailNames->InsertEntry(*pString);
rSubRegions.InsertEntry(*pString);
@@ -164,26 +165,82 @@ public:
Beschreibung: User Data Klasse fuer Bereichsinformationen
----------------------------------------------------------------------------*/
-SectRepr::SectRepr( USHORT nPos, SwSection& rSect ) :
- aSection( CONTENT_SECTION, aEmptyStr ),
- aBrush( RES_BACKGROUND ),
- aFrmDirItem( FRMDIR_ENVIRONMENT, RES_FRAMEDIR ),
- aLRSpaceItem( RES_LR_SPACE ),
- bSelected(FALSE)
+class SectRepr
+{
+private:
+ SwSectionData m_SectionData;
+ SwFmtCol m_Col;
+ SvxBrushItem m_Brush;
+ SwFmtFtnAtTxtEnd m_FtnNtAtEnd;
+ SwFmtEndAtTxtEnd m_EndNtAtEnd;
+ SwFmtNoBalancedColumns m_Balance;
+ SvxFrameDirectionItem m_FrmDirItem;
+ SvxLRSpaceItem m_LRSpaceItem;
+ USHORT m_nArrPos;
+ // zeigt an, ob evtl. Textinhalt im Bereich ist
+ bool m_bContent : 1;
+ // fuer Multiselektion erst markieren, dann mit der TreeListBox arbeiten!
+ bool m_bSelected : 1;
+ uno::Sequence<sal_Int8> m_TempPasswd;
+
+public:
+ SectRepr(USHORT nPos, SwSection& rSect);
+ bool operator==(SectRepr& rSectRef) const
+ { return m_nArrPos == rSectRef.GetArrPos(); }
+
+ bool operator< (SectRepr& rSectRef) const
+ { return m_nArrPos < rSectRef.GetArrPos(); }
+
+ SwSectionData & GetSectionData() { return m_SectionData; }
+ SwSectionData const&GetSectionData() const { return m_SectionData; }
+ SwFmtCol& GetCol() { return m_Col; }
+ SvxBrushItem& GetBackground() { return m_Brush; }
+ SwFmtFtnAtTxtEnd& GetFtnNtAtEnd() { return m_FtnNtAtEnd; }
+ SwFmtEndAtTxtEnd& GetEndNtAtEnd() { return m_EndNtAtEnd; }
+ SwFmtNoBalancedColumns& GetBalance() { return m_Balance; }
+ SvxFrameDirectionItem& GetFrmDir() { return m_FrmDirItem; }
+ SvxLRSpaceItem& GetLRSpace() { return m_LRSpaceItem; }
+
+ USHORT GetArrPos() const { return m_nArrPos; }
+ String GetFile() const;
+ String GetSubRegion() const;
+ void SetFile(String const& rFile);
+ void SetFilter(String const& rFilter);
+ void SetSubRegion(String const& rSubRegion);
+
+ bool IsContent() { return m_bContent; }
+ void SetContent(bool const bValue) { m_bContent = bValue; }
+
+ void SetSelected() { m_bSelected = true; }
+ bool IsSelected() const { return m_bSelected; }
+
+ uno::Sequence<sal_Int8> & GetTempPasswd() { return m_TempPasswd; }
+ void SetTempPasswd(const uno::Sequence<sal_Int8> & rPasswd)
+ { m_TempPasswd = rPasswd; }
+};
+
+
+SV_IMPL_OP_PTRARR_SORT( SectReprArr, SectReprPtr )
+
+SectRepr::SectRepr( USHORT nPos, SwSection& rSect )
+ : m_SectionData( rSect )
+ , m_Brush( RES_BACKGROUND )
+ , m_FrmDirItem( FRMDIR_ENVIRONMENT, RES_FRAMEDIR )
+ , m_LRSpaceItem( RES_LR_SPACE )
+ , m_nArrPos(nPos)
+ , m_bContent(m_SectionData.GetLinkFileName().Len() == 0)
+ , m_bSelected(false)
{
- aSection = rSect;
- bContent = aSection.GetLinkFileName().Len() == 0;
- nArrPos=nPos;
SwSectionFmt *pFmt = rSect.GetFmt();
if( pFmt )
{
- aCol = pFmt->GetCol();
- aBrush = pFmt->GetBackground();
- aFtnNtAtEnd = pFmt->GetFtnAtTxtEnd();
- aEndNtAtEnd = pFmt->GetEndAtTxtEnd();
- aBalance.SetValue(pFmt->GetBalancedColumns().GetValue());
- aFrmDirItem = pFmt->GetFrmDir();
- aLRSpaceItem = pFmt->GetLRSpace();
+ m_Col = pFmt->GetCol();
+ m_Brush = pFmt->GetBackground();
+ m_FtnNtAtEnd = pFmt->GetFtnAtTxtEnd();
+ m_EndNtAtEnd = pFmt->GetEndAtTxtEnd();
+ m_Balance.SetValue(pFmt->GetBalancedColumns().GetValue());
+ m_FrmDirItem = pFmt->GetFrmDir();
+ m_LRSpaceItem = pFmt->GetLRSpace();
}
}
@@ -192,7 +249,7 @@ void SectRepr::SetFile( const String& rFile )
String sNewFile( INetURLObject::decode( rFile, INET_HEX_ESCAPE,
INetURLObject::DECODE_UNAMBIGUOUS,
RTL_TEXTENCODING_UTF8 ));
- String sOldFileName( aSection.GetLinkFileName() );
+ String sOldFileName( m_SectionData.GetLinkFileName() );
String sSub( sOldFileName.GetToken( 2, sfx2::cTokenSeperator ) );
if( rFile.Len() || sSub.Len() )
@@ -205,19 +262,23 @@ void SectRepr::SetFile( const String& rFile )
sNewFile += sSub;
}
- aSection.SetLinkFileName( sNewFile );
+ m_SectionData.SetLinkFileName( sNewFile );
if( rFile.Len() || sSub.Len() )
- aSection.SetType( FILE_LINK_SECTION );
+ {
+ m_SectionData.SetType( FILE_LINK_SECTION );
+ }
else
- aSection.SetType( CONTENT_SECTION );
+ {
+ m_SectionData.SetType( CONTENT_SECTION );
+ }
}
void SectRepr::SetFilter( const String& rFilter )
{
String sNewFile;
- String sOldFileName( aSection.GetLinkFileName() );
+ String sOldFileName( m_SectionData.GetLinkFileName() );
String sFile( sOldFileName.GetToken( 0, sfx2::cTokenSeperator ) );
String sSub( sOldFileName.GetToken( 2, sfx2::cTokenSeperator ) );
@@ -227,16 +288,18 @@ void SectRepr::SetFilter( const String& rFilter )
else if( sSub.Len() )
(( sNewFile = sfx2::cTokenSeperator ) += sfx2::cTokenSeperator ) += sSub;
- aSection.SetLinkFileName( sNewFile );
+ m_SectionData.SetLinkFileName( sNewFile );
if( sNewFile.Len() )
- aSection.SetType( FILE_LINK_SECTION );
+ {
+ m_SectionData.SetType( FILE_LINK_SECTION );
+ }
}
void SectRepr::SetSubRegion(const String& rSubRegion)
{
String sNewFile;
- String sOldFileName( aSection.GetLinkFileName() );
+ String sOldFileName( m_SectionData.GetLinkFileName() );
String sFilter( sOldFileName.GetToken( 1, sfx2::cTokenSeperator ) );
sOldFileName = sOldFileName.GetToken( 0, sfx2::cTokenSeperator );
@@ -244,21 +307,25 @@ void SectRepr::SetSubRegion(const String& rSubRegion)
(((( sNewFile = sOldFileName ) += sfx2::cTokenSeperator ) += sFilter )
+= sfx2::cTokenSeperator ) += rSubRegion;
- aSection.SetLinkFileName( sNewFile );
+ m_SectionData.SetLinkFileName( sNewFile );
if( rSubRegion.Len() || sOldFileName.Len() )
- aSection.SetType( FILE_LINK_SECTION );
+ {
+ m_SectionData.SetType( FILE_LINK_SECTION );
+ }
else
- aSection.SetType( CONTENT_SECTION );
+ {
+ m_SectionData.SetType( CONTENT_SECTION );
+ }
}
String SectRepr::GetFile() const
{
- String sLinkFile( aSection.GetLinkFileName() );
+ String sLinkFile( m_SectionData.GetLinkFileName() );
if( sLinkFile.Len() )
{
- if( DDE_LINK_SECTION == aSection.GetType() )
+ if (DDE_LINK_SECTION == m_SectionData.GetType())
{
USHORT n = sLinkFile.SearchAndReplace( sfx2::cTokenSeperator, ' ' );
sLinkFile.SearchAndReplace( sfx2::cTokenSeperator, ' ', n );
@@ -276,7 +343,7 @@ String SectRepr::GetFile() const
String SectRepr::GetSubRegion() const
{
- String sLinkFile( aSection.GetLinkFileName() );
+ String sLinkFile( m_SectionData.GetLinkFileName() );
if( sLinkFile.Len() )
sLinkFile = sLinkFile.GetToken( 2, sfx2::cTokenSeperator );
return sLinkFile;
@@ -284,7 +351,6 @@ String SectRepr::GetSubRegion() const
-
/*----------------------------------------------------------------------------
Beschreibung: Dialog Bearbeiten Bereiche
----------------------------------------------------------------------------*/
@@ -404,7 +470,8 @@ BOOL SwEditRegionDlg::CheckPasswd(CheckBox* pBox)
while( pEntry )
{
SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData();
- if(!pRepr->GetTempPasswd().getLength() && pRepr->GetPasswd().getLength())
+ if (!pRepr->GetTempPasswd().getLength()
+ && pRepr->GetSectionData().GetPassword().getLength())
{
SwTestPasswdDlg aPasswdDlg(this);
bRet = FALSE;
@@ -413,7 +480,8 @@ BOOL SwEditRegionDlg::CheckPasswd(CheckBox* pBox)
String sNewPasswd( aPasswdDlg.GetPassword() );
UNO_NMSPC::Sequence <sal_Int8 > aNewPasswd;
SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
- if(SvPasswordHelper::CompareHashPassword(pRepr->GetPasswd(), sNewPasswd))
+ if (SvPasswordHelper::CompareHashPassword(
+ pRepr->GetSectionData().GetPassword(), sNewPasswd))
{
pRepr->SetTempPasswd(aNewPasswd);
bRet = TRUE;
@@ -460,7 +528,7 @@ void SwEditRegionDlg::RecurseList( const SwSectionFmt* pFmt, SvLBoxEntry* pEntry
SectRepr* pSectRepr = new SectRepr( n,
*(pSect=pFmt->GetSection()) );
Image aImg = BuildBitmap( pSect->IsProtect(),pSect->IsHidden(), FALSE);
- pEntry = aTree.InsertEntry( pSect->GetName(), aImg, aImg );
+ pEntry = aTree.InsertEntry(pSect->GetSectionName(), aImg, aImg);
Image aHCImg = BuildBitmap( pSect->IsProtect(),pSect->IsHidden(), TRUE);
aTree.SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
aTree.SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
@@ -493,7 +561,8 @@ void SwEditRegionDlg::RecurseList( const SwSectionFmt* pFmt, SvLBoxEntry* pEntry
FindArrPos( pSect->GetFmt() ), *pSect );
Image aImage = BuildBitmap( pSect->IsProtect(),
pSect->IsHidden(), FALSE);
- pNEntry=aTree.InsertEntry( pSect->GetName(), aImage, aImage, pEntry);
+ pNEntry = aTree.InsertEntry(
+ pSect->GetSectionName(), aImage, aImage, pEntry);
Image aHCImg = BuildBitmap( pSect->IsProtect(),pSect->IsHidden(), TRUE);
aTree.SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
aTree.SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
@@ -552,7 +621,7 @@ void SwEditRegionDlg::SelectSection(const String& rSectionName)
while(pEntry)
{
SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData();
- if(pRepr->GetSection().GetName() == rSectionName)
+ if (pRepr->GetSectionData().GetSectionName() == rSectionName)
break;
pEntry = aTree.Next(pEntry);
}
@@ -589,15 +658,15 @@ IMPL_LINK( SwEditRegionDlg, GetFirstEntryHdl, SvTreeListBox *, pBox )
// <--
aFileCB.EnableTriState( TRUE );
- BOOL bHiddenValid = TRUE;
- BOOL bProtectValid = TRUE;
- BOOL bConditionValid = TRUE;
+ bool bHiddenValid = true;
+ bool bProtectValid = true;
+ bool bConditionValid = true;
// --> FME 2004-06-22 #114856# edit in readonly sections
- BOOL bEditInReadonlyValid = TRUE;
- BOOL bEditInReadonly = TRUE;
+ bool bEditInReadonlyValid = true;
+ bool bEditInReadonly = true;
// <--
- BOOL bHidden = TRUE;
- BOOL bProtect = TRUE;
+ bool bHidden = true;
+ bool bProtect = true;
String sCondition;
BOOL bFirst = TRUE;
BOOL bFileValid = TRUE;
@@ -607,29 +676,32 @@ IMPL_LINK( SwEditRegionDlg, GetFirstEntryHdl, SvTreeListBox *, pBox )
while( pEntry )
{
SectRepr* pRepr=(SectRepr*) pEntry->GetUserData();
+ SwSectionData const& rData( pRepr->GetSectionData() );
if(bFirst)
{
- sCondition = pRepr->GetCondition();
- bHidden = pRepr->IsHidden();
- bProtect = pRepr->IsProtect();
+ sCondition = rData.GetCondition();
+ bHidden = rData.IsHidden();
+ bProtect = rData.IsProtectFlag();
// --> FME 2004-06-22 #114856# edit in readonly sections
- bEditInReadonly = pRepr->IsEditInReadonly();
+ bEditInReadonly = rData.IsEditInReadonlyFlag();
// <--
- bFile = pRepr->GetSectionType() != CONTENT_SECTION;
- aCurPasswd = pRepr->GetPasswd();
+ bFile = (rData.GetType() != CONTENT_SECTION);
+ aCurPasswd = rData.GetPassword();
}
else
{
- String sTemp(pRepr->GetCondition());
+ String sTemp(rData.GetCondition());
if(sCondition != sTemp)
bConditionValid = FALSE;
- bHiddenValid = bHidden == pRepr->IsHidden();
- bProtectValid = bProtect == pRepr->IsProtect();
+ bHiddenValid = (bHidden == rData.IsHidden());
+ bProtectValid = (bProtect == rData.IsProtectFlag());
// --> FME 2004-06-22 #114856# edit in readonly sections
- bEditInReadonlyValid = bEditInReadonly == pRepr->IsEditInReadonly();
+ bEditInReadonlyValid =
+ (bEditInReadonly == rData.IsEditInReadonlyFlag());
// <--
- bFileValid = (pRepr->GetSectionType() != CONTENT_SECTION) == bFile;
- bPasswdValid = aCurPasswd == pRepr->GetPasswd();
+ bFileValid = (bFile ==
+ (rData.GetType() != CONTENT_SECTION));
+ bPasswdValid = (aCurPasswd == rData.GetPassword());
}
pEntry = pBox->NextSelected(pEntry);
bFirst = FALSE;
@@ -685,13 +757,14 @@ IMPL_LINK( SwEditRegionDlg, GetFirstEntryHdl, SvTreeListBox *, pBox )
aCurName .Enable(TRUE);
aOptionsPB .Enable(TRUE);
SectRepr* pRepr=(SectRepr*) pEntry->GetUserData();
- aConditionED.SetText(pRepr->GetCondition());
+ SwSectionData const& rData( pRepr->GetSectionData() );
+ aConditionED.SetText(rData.GetCondition());
aHideCB.Enable();
- aHideCB.SetState(pRepr->IsHidden() ? STATE_CHECK : STATE_NOCHECK);
+ aHideCB.SetState((rData.IsHidden()) ? STATE_CHECK : STATE_NOCHECK);
BOOL bHide = STATE_CHECK == aHideCB.GetState();
aConditionED.Enable(bHide);
aConditionFT.Enable(bHide);
- aPasswdCB.Check(pRepr->GetPasswd().getLength() > 0);
+ aPasswdCB.Check(rData.GetPassword().getLength() > 0);
aOK.Enable();
aPasswdCB.Enable();
@@ -707,7 +780,7 @@ IMPL_LINK( SwEditRegionDlg, GetFirstEntryHdl, SvTreeListBox *, pBox )
aFileCB.Check(TRUE);
aFileNameED.SetText(aFile);
aSubRegionED.SetText(sSub);
- aDDECB.Check(pRepr->GetSectionType() == DDE_LINK_SECTION );
+ aDDECB.Check(rData.GetType() == DDE_LINK_SECTION);
}
else
{
@@ -718,11 +791,13 @@ IMPL_LINK( SwEditRegionDlg, GetFirstEntryHdl, SvTreeListBox *, pBox )
}
UseFileHdl(&aFileCB);
DDEHdl( &aDDECB );
- aProtectCB.SetState(pRepr->IsProtect() ? STATE_CHECK : STATE_NOCHECK);
+ aProtectCB.SetState((rData.IsProtectFlag())
+ ? STATE_CHECK : STATE_NOCHECK);
aProtectCB.Enable();
// --> FME 2004-06-22 #114856# edit in readonly sections
- aEditInReadonlyCB.SetState( pRepr->IsEditInReadonly() ? STATE_CHECK : STATE_NOCHECK);
+ aEditInReadonlyCB.SetState((rData.IsEditInReadonlyFlag())
+ ? STATE_CHECK : STATE_NOCHECK);
aEditInReadonlyCB.Enable();
// <--
@@ -794,8 +869,10 @@ IMPL_LINK( SwEditRegionDlg, OkHdl, CheckBox *, EMPTYARG )
{
SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData();
SwSectionFmt* pFmt = aOrigArray[ pRepr->GetArrPos() ];
- if( !pRepr->GetSection().IsProtectFlag())
- pRepr->GetSection().SetPasswd(UNO_NMSPC::Sequence <sal_Int8 >());
+ if (!pRepr->GetSectionData().IsProtectFlag())
+ {
+ pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >());
+ }
USHORT nNewPos = rDocFmts.GetPos( pFmt );
if( USHRT_MAX != nNewPos )
{
@@ -821,7 +898,7 @@ IMPL_LINK( SwEditRegionDlg, OkHdl, CheckBox *, EMPTYARG )
if( pFmt->GetLRSpace() != pRepr->GetLRSpace())
pSet->Put( pRepr->GetLRSpace());
- rSh.ChgSection( nNewPos, pRepr->GetSection(),
+ rSh.UpdateSection( nNewPos, pRepr->GetSectionData(),
pSet->Count() ? pSet : 0 );
delete pSet;
}
@@ -863,7 +940,7 @@ IMPL_LINK( SwEditRegionDlg, ChangeProtectHdl, TriStateBox *, pBox )
while( pEntry )
{
SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData();
- pRepr->SetProtect(bCheck);
+ pRepr->GetSectionData().SetProtectFlag(bCheck);
Image aImage = BuildBitmap( bCheck,
STATE_CHECK == aHideCB.GetState(), FALSE);
aTree.SetExpandedEntryBmp(pEntry, aImage, BMP_COLOR_NORMAL);
@@ -891,7 +968,7 @@ IMPL_LINK( SwEditRegionDlg, ChangeHideHdl, TriStateBox *, pBox )
while( pEntry )
{
SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData();
- pRepr->SetHidden(STATE_CHECK == pBox->GetState());
+ pRepr->GetSectionData().SetHidden(STATE_CHECK == pBox->GetState());
Image aImage = BuildBitmap(STATE_CHECK == aProtectCB.GetState(),
STATE_CHECK == pBox->GetState(), FALSE);
aTree.SetExpandedEntryBmp(pEntry, aImage, BMP_COLOR_NORMAL);
@@ -924,7 +1001,8 @@ IMPL_LINK( SwEditRegionDlg, ChangeEditInReadonlyHdl, TriStateBox *, pBox )
while( pEntry )
{
SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData();
- pRepr->SetEditInReadonly(STATE_CHECK == pBox->GetState());
+ pRepr->GetSectionData().SetEditInReadonlyFlag(
+ STATE_CHECK == pBox->GetState());
pEntry = aTree.NextSelected(pEntry);
}
@@ -1028,7 +1106,7 @@ IMPL_LINK( SwEditRegionDlg, UseFileHdl, CheckBox *, pBox )
{
pSectRepr->SetFile(aEmptyStr);
pSectRepr->SetSubRegion(aEmptyStr);
- pSectRepr->SetFilePasswd(aEmptyStr);
+ pSectRepr->GetSectionData().SetLinkFilePassword(aEmptyStr);
}
pEntry = aTree.NextSelected(pEntry);
@@ -1221,8 +1299,8 @@ IMPL_LINK( SwEditRegionDlg, FileNameHdl, Edit *, pEdit )
nPos = sLink.SearchAndReplace( ' ', sfx2::cTokenSeperator );
sLink.SearchAndReplace( ' ', sfx2::cTokenSeperator, nPos );
- pSectRepr->GetSection().SetLinkFileName( sLink );
- pSectRepr->GetSection().SetType( DDE_LINK_SECTION );
+ pSectRepr->GetSectionData().SetLinkFileName( sLink );
+ pSectRepr->GetSectionData().SetType( DDE_LINK_SECTION );
}
else
{
@@ -1237,7 +1315,7 @@ IMPL_LINK( SwEditRegionDlg, FileNameHdl, Edit *, pEdit )
aAbs, sTmp, URIHelper::GetMaybeFileHdl() );
}
pSectRepr->SetFile( sTmp );
- pSectRepr->SetFilePasswd( aEmptyStr );
+ pSectRepr->GetSectionData().SetLinkFilePassword( aEmptyStr );
}
}
else
@@ -1259,6 +1337,7 @@ IMPL_LINK( SwEditRegionDlg, DDEHdl, CheckBox*, pBox )
{
BOOL bFile = aFileCB.IsChecked();
SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData();
+ SwSectionData & rData( pSectRepr->GetSectionData() );
BOOL bDDE = pBox->IsChecked();
if(bDDE)
{
@@ -1267,13 +1346,13 @@ IMPL_LINK( SwEditRegionDlg, DDEHdl, CheckBox*, pBox )
aDDECommandFT.Show();
aSubRegionFT.Hide();
aSubRegionED.Hide();
- if(FILE_LINK_SECTION == pSectRepr->GetSectionType() )
+ if (FILE_LINK_SECTION == rData.GetType())
{
pSectRepr->SetFile(aEmptyStr);
aFileNameED.SetText(aEmptyStr);
- pSectRepr->SetFilePasswd( aEmptyStr );
+ rData.SetLinkFilePassword( aEmptyStr );
}
- pSectRepr->SetSectionType( DDE_LINK_SECTION );
+ rData.SetType(DDE_LINK_SECTION);
}
else
{
@@ -1285,11 +1364,11 @@ IMPL_LINK( SwEditRegionDlg, DDEHdl, CheckBox*, pBox )
aSubRegionED.Enable(bFile);
aSubRegionFT.Enable(bFile);
aSubRegionED.Enable(bFile);
- if(DDE_LINK_SECTION == pSectRepr->GetSectionType() )
+ if (DDE_LINK_SECTION == rData.GetType())
{
- pSectRepr->SetSectionType( FILE_LINK_SECTION );
+ rData.SetType(FILE_LINK_SECTION);
pSectRepr->SetFile(aEmptyStr);
- pSectRepr->SetFilePasswd( aEmptyStr );
+ rData.SetLinkFilePassword( aEmptyStr );
aFileNameED.SetText(aEmptyStr);
}
}
@@ -1343,10 +1422,12 @@ IMPL_LINK( SwEditRegionDlg, ChangePasswdHdl, Button *, pBox )
break;
}
}
- pRepr->GetSection().SetPasswd(pRepr->GetTempPasswd());
+ pRepr->GetSectionData().SetPassword(pRepr->GetTempPasswd());
}
else
- pRepr->GetSection().SetPasswd(UNO_NMSPC::Sequence <sal_Int8 >());
+ {
+ pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >());
+ }
pEntry = aTree.NextSelected(pEntry);
}
return 0;
@@ -1368,7 +1449,7 @@ IMPL_LINK( SwEditRegionDlg, NameEditHdl, Edit *, EMPTYARG )
String aName = aCurName.GetText();
aTree.SetEntryText(pEntry,aName);
SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData();
- pRepr->GetSection().SetName(aName);
+ pRepr->GetSectionData().SetSectionName(aName);
aOK.Enable(aName.Len() != 0);
}
@@ -1389,7 +1470,7 @@ IMPL_LINK( SwEditRegionDlg, ConditionEditHdl, Edit *, pEdit )
while( pEntry )
{
SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData();
- pRepr->SetCondition (pEdit->GetText());
+ pRepr->GetSectionData().SetCondition(pEdit->GetText());
pEntry = aTree.NextSelected(pEntry);
}
return 0;
@@ -1420,7 +1501,7 @@ IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg )
SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData();
pSectRepr->SetFile( sFileName );
pSectRepr->SetFilter( sFilterName );
- pSectRepr->SetFilePasswd( sPassword );
+ pSectRepr->GetSectionData().SetLinkFilePassword(sPassword);
aFileNameED.SetText( pSectRepr->GetFile() );
}
@@ -1495,8 +1576,8 @@ static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox )
SwInsertSectionTabDialog::SwInsertSectionTabDialog(
Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh) :
SfxTabDialog( pParent, SW_RES(DLG_INSERT_SECTION), &rSet ),
- rWrtSh(rSh),
- pToInsertSection(0)
+ rWrtSh(rSh)
+ , m_pSectionData(0)
{
String sInsert(SW_RES(ST_INSERT));
GetOKButton().SetText(sInsert);
@@ -1527,7 +1608,6 @@ SwInsertSectionTabDialog::SwInsertSectionTabDialog(
* --------------------------------------------------*/
SwInsertSectionTabDialog::~SwInsertSectionTabDialog()
{
- delete pToInsertSection;
}
/* -----------------21.05.99 10:23-------------------
*
@@ -1556,10 +1636,9 @@ void SwInsertSectionTabDialog::PageCreated( USHORT nId, SfxTabPage &rPage )
*
* --------------------------------------------------*/
-void SwInsertSectionTabDialog::SetSection(const SwSection& rSect)
+void SwInsertSectionTabDialog::SetSectionData(SwSectionData const& rSect)
{
- pToInsertSection = new SwSection(CONTENT_SECTION, aEmptyStr);
- *pToInsertSection = rSect;
+ m_pSectionData.reset( new SwSectionData(rSect) );
}
/* -----------------21.05.99 13:10-------------------
*
@@ -1567,9 +1646,10 @@ void SwInsertSectionTabDialog::SetSection(const SwSection& rSect)
short SwInsertSectionTabDialog::Ok()
{
short nRet = SfxTabDialog::Ok();
- DBG_ASSERT(pToInsertSection, "keiner Section?");
+ DBG_ASSERT(m_pSectionData.get(),
+ "SwInsertSectionTabDialog: no SectionData?");
const SfxItemSet* pOutputItemSet = GetOutputItemSet();
- rWrtSh.InsertSection(*pToInsertSection, pOutputItemSet);
+ rWrtSh.InsertSection(*m_pSectionData, pOutputItemSet);
SfxViewFrame* pViewFrm = rWrtSh.GetView().GetViewFrame();
uno::Reference< frame::XDispatchRecorder > xRecorder =
pViewFrm->GetBindings().GetRecorder();
@@ -1582,15 +1662,20 @@ short SwInsertSectionTabDialog::Ok()
aRequest.AppendItem(SfxUInt16Item(SID_ATTR_COLUMNS,
((const SwFmtCol*)pCol)->GetColumns().Count()));
}
- aRequest.AppendItem(SfxStringItem( FN_PARAM_REGION_NAME, pToInsertSection->GetName()));
- aRequest.AppendItem(SfxStringItem( FN_PARAM_REGION_CONDITION, pToInsertSection->GetCondition()));
- aRequest.AppendItem(SfxBoolItem( FN_PARAM_REGION_HIDDEN, pToInsertSection->IsHidden()));
- aRequest.AppendItem(SfxBoolItem(FN_PARAM_REGION_PROTECT, pToInsertSection->IsProtect()));
+ aRequest.AppendItem(SfxStringItem( FN_PARAM_REGION_NAME,
+ m_pSectionData->GetSectionName()));
+ aRequest.AppendItem(SfxStringItem( FN_PARAM_REGION_CONDITION,
+ m_pSectionData->GetCondition()));
+ aRequest.AppendItem(SfxBoolItem( FN_PARAM_REGION_HIDDEN,
+ m_pSectionData->IsHidden()));
+ aRequest.AppendItem(SfxBoolItem( FN_PARAM_REGION_PROTECT,
+ m_pSectionData->IsProtectFlag()));
// --> FME 2004-06-22 #114856# edit in readonly sections
- aRequest.AppendItem(SfxBoolItem(FN_PARAM_REGION_EDIT_IN_READONLY, pToInsertSection->IsEditInReadonly()));
+ aRequest.AppendItem(SfxBoolItem( FN_PARAM_REGION_EDIT_IN_READONLY,
+ m_pSectionData->IsEditInReadonlyFlag()));
// <--
- String sLinkFileName( pToInsertSection->GetLinkFileName() );
+ String sLinkFileName( m_pSectionData->GetLinkFileName() );
aRequest.AppendItem(SfxStringItem( FN_PARAM_1, sLinkFileName.GetToken( 0, sfx2::cTokenSeperator )));
aRequest.AppendItem(SfxStringItem( FN_PARAM_2, sLinkFileName.GetToken( 1, sfx2::cTokenSeperator )));
aRequest.AppendItem(SfxStringItem( FN_PARAM_3, sLinkFileName.GetToken( 2, sfx2::cTokenSeperator )));
@@ -1675,13 +1760,16 @@ void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh)
lcl_FillSubRegionList( *m_pWrtSh, aSubRegionED, &aCurName );
- SwSection* pSect = ((SwInsertSectionTabDialog*)GetTabDialog())->GetSection();
- if( pSect ) // etwas vorgegeben ?
+ SwSectionData *const pSectionData =
+ static_cast<SwInsertSectionTabDialog*>(GetTabDialog())
+ ->GetSectionData();
+ if (pSectionData) // something set?
{
- aCurName.SetText( rSh.GetUniqueSectionName( &pSect->GetName() ));
- aProtectCB.Check( 0 != pSect->IsProtect() );
- m_sFileName = pSect->GetLinkFileName();
- m_sFilePasswd = pSect->GetLinkFilePassWd();
+ aCurName.SetText(
+ rSh.GetUniqueSectionName(& pSectionData->GetSectionName()));
+ aProtectCB.Check( 0 != pSectionData->IsProtectFlag() );
+ m_sFileName = pSectionData->GetLinkFileName();
+ m_sFilePasswd = pSectionData->GetLinkFilePassword();
aFileCB.Check( 0 != m_sFileName.Len() );
aFileNameED.SetText( m_sFileName );
UseFileHdl( &aFileCB );
@@ -1696,16 +1784,18 @@ void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh)
* --------------------------------------------------*/
BOOL SwInsertSectionTabPage::FillItemSet( SfxItemSet& )
{
- SwSection aSection(CONTENT_SECTION, aCurName.GetText());
+ SwSectionData aSection(CONTENT_SECTION, aCurName.GetText());
aSection.SetCondition(aConditionED.GetText());
BOOL bProtected = aProtectCB.IsChecked();
- aSection.SetProtect(bProtected);
+ aSection.SetProtectFlag(bProtected);
aSection.SetHidden(aHideCB.IsChecked());
// --> FME 2004-06-22 #114856# edit in readonly sections
- aSection.SetEditInReadonly(aEditInReadonlyCB.IsChecked());
+ aSection.SetEditInReadonlyFlag(aEditInReadonlyCB.IsChecked());
// <--
if(bProtected)
- aSection.SetPasswd(m_aNewPasswd);
+ {
+ aSection.SetPassword(m_aNewPasswd);
+ }
String sFileName = aFileNameED.GetText();
String sSubRegion = aSubRegionED.GetText();
BOOL bDDe = aDDECB.IsChecked();
@@ -1733,7 +1823,7 @@ BOOL SwInsertSectionTabPage::FillItemSet( SfxItemSet& )
aAbs = pMedium->GetURLObject();
aLinkFile = URIHelper::SmartRel2Abs(
aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
- aSection.SetLinkFilePassWd( m_sFilePasswd );
+ aSection.SetLinkFilePassword( m_sFilePasswd );
}
aLinkFile += sfx2::cTokenSeperator;
@@ -1750,7 +1840,7 @@ BOOL SwInsertSectionTabPage::FillItemSet( SfxItemSet& )
FILE_LINK_SECTION);
}
}
- ((SwInsertSectionTabDialog*)GetTabDialog())->SetSection(aSection);
+ ((SwInsertSectionTabDialog*)GetTabDialog())->SetSectionData(aSection);
return TRUE;
}
/* -----------------21.05.99 10:32-------------------
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
index a49141e896d9..66cb07f33e9c 100644
--- a/sw/source/ui/dochdl/swdtflvr.cxx
+++ b/sw/source/ui/dochdl/swdtflvr.cxx
@@ -2211,9 +2211,9 @@ int SwTransferable::_PasteDDE( TransferableDataHelper& rData,
if( rWrtShell.HasSelection() )
rWrtShell.DelRight();
- SwSection aSect( DDE_LINK_SECTION, aName );
+ SwSectionData aSect( DDE_LINK_SECTION, aName );
aSect.SetLinkFileName( aCmd );
- aSect.SetProtect();
+ aSect.SetProtectFlag(true);
rWrtShell.InsertSection( aSect );
pDDETyp = 0; // FeldTypen wieder entfernen
@@ -2554,10 +2554,11 @@ int SwTransferable::_PasteFileName( TransferableDataHelper& rData,
)
{
// und dann per PostUser Event den Bereich-Einfuegen-Dialog hochreissen
- SwSection* pSect = new SwSection( FILE_LINK_SECTION,
+ SwSectionData * pSect = new SwSectionData(
+ FILE_LINK_SECTION,
rSh.GetDoc()->GetUniqueSectionName() );
pSect->SetLinkFileName( sFileURL );
- pSect->SetProtect( TRUE );
+ pSect->SetProtectFlag( true );
Application::PostUserEvent( STATIC_LINK( &rSh, SwWrtShell,
InsertRegionDialog ), pSect );
@@ -2635,7 +2636,9 @@ int SwTransferable::_PasteDBData( TransferableDataHelper& rData,
if(pFmView) {
const OXFormsDescriptor &rDesc = OXFormsTransferable::extractDescriptor(rData);
if(0 != (pObj = pFmView->CreateXFormsControl(rDesc)))
- rSh.SwFEShell::Insert( *pObj, 0, 0, pDragPt );
+ {
+ rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt );
+ }
}
}
else if( nWh )
@@ -2696,7 +2699,7 @@ int SwTransferable::_PasteDBData( TransferableDataHelper& rData,
if (pFmView && bHaveColumnDescriptor)
{
if ( 0 != (pObj = pFmView->CreateFieldControl( OColumnTransferable::extractColumnDescriptor(rData) ) ) )
- rSh.SwFEShell::Insert( *pObj, 0, 0, pDragPt );
+ rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt );
}
}
nRet = 1;
diff --git a/sw/source/ui/docvw/AnchorOverlayObject.cxx b/sw/source/ui/docvw/AnchorOverlayObject.cxx
new file mode 100644
index 000000000000..53afaf625710
--- /dev/null
+++ b/sw/source/ui/docvw/AnchorOverlayObject.cxx
@@ -0,0 +1,467 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: postit.cxx,v $
+ * $Revision: 1.8.42.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <AnchorOverlayObject.hxx>
+#include <SidebarWindowsConsts.hxx>
+
+#include <swrect.hxx>
+#include <view.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/svdview.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+
+#include <sw_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
+
+namespace sw { namespace sidebarwindows {
+
+//////////////////////////////////////////////////////////////////////////////
+// helper class: Primitive for discrete visualisation
+
+class AnchorPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D
+{
+private:
+ basegfx::B2DPolygon maTriangle;
+ basegfx::B2DPolygon maLine;
+ basegfx::B2DPolygon maLineTop;
+ const AnchorState maAnchorState;
+ basegfx::BColor maColor;
+
+ // discrete line width
+ double mfLogicLineWidth;
+
+ // bitfield
+ bool mbShadow : 1;
+ bool mbLineSolid : 1;
+
+protected:
+ virtual drawinglayer::primitive2d::Primitive2DSequence create2DDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation) const;
+
+public:
+ AnchorPrimitive( const basegfx::B2DPolygon& rTriangle,
+ const basegfx::B2DPolygon& rLine,
+ const basegfx::B2DPolygon& rLineTop,
+ AnchorState aAnchorState,
+ const basegfx::BColor& rColor,
+ double fLogicLineWidth,
+ bool bShadow,
+ bool bLineSolid )
+ : drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D(),
+ maTriangle(rTriangle),
+ maLine(rLine),
+ maLineTop(rLineTop),
+ maAnchorState(aAnchorState),
+ maColor(rColor),
+ mfLogicLineWidth(fLogicLineWidth),
+ mbShadow(bShadow),
+ mbLineSolid(bLineSolid)
+ {}
+
+ // data access
+ const basegfx::B2DPolygon& getTriangle() const { return maTriangle; }
+ const basegfx::B2DPolygon& getLine() const { return maLine; }
+ const basegfx::B2DPolygon& getLineTop() const { return maLineTop; }
+ const AnchorState getAnchorState() const { return maAnchorState; }
+ const basegfx::BColor& getColor() const { return maColor; }
+ double getLogicLineWidth() const { return mfLogicLineWidth; }
+ bool getShadow() const { return mbShadow; }
+ bool getLineSolid() const { return mbLineSolid; }
+
+ virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const;
+
+ DeclPrimitrive2DIDBlock()
+};
+
+drawinglayer::primitive2d::Primitive2DSequence AnchorPrimitive::create2DDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const
+{
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+
+ if ( AS_TRI == maAnchorState ||
+ AS_ALL == maAnchorState ||
+ AS_START == maAnchorState )
+ {
+ // create triangle
+ const drawinglayer::primitive2d::Primitive2DReference aTriangle(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(getTriangle()),
+ getColor()));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aTriangle);
+ }
+
+ if ( AS_ALL == maAnchorState ||
+ AS_START == maAnchorState )
+ {
+ // create line start
+ const drawinglayer::attribute::LineAttribute aLineAttribute(
+ getColor(),
+ getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit()));
+
+ if(getLineSolid())
+ {
+ const drawinglayer::primitive2d::Primitive2DReference aSolidLine(
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ getLine(),
+ aLineAttribute));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aSolidLine);
+ }
+ else
+ {
+ ::std::vector< double > aDotDashArray;
+ const double fDistance(3.0 * 15.0);
+ const double fDashLen(5.0 * 15.0);
+
+ aDotDashArray.push_back(fDashLen);
+ aDotDashArray.push_back(fDistance);
+
+ const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(
+ aDotDashArray,
+ fDistance + fDashLen);
+
+ const drawinglayer::primitive2d::Primitive2DReference aStrokedLine(
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ getLine(),
+ aLineAttribute,
+ aStrokeAttribute));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aStrokedLine);
+ }
+ }
+
+ if(aRetval.hasElements() && getShadow())
+ {
+ // shadow is only for triangle and line start, and in upper left
+ // and lower right direction, in different colors
+ const double fColorChange(20.0 / 255.0);
+ const basegfx::B3DTuple aColorChange(fColorChange, fColorChange, fColorChange);
+ basegfx::BColor aLighterColor(getColor() + aColorChange);
+ basegfx::BColor aDarkerColor(getColor() - aColorChange);
+
+ aLighterColor.clamp();
+ aDarkerColor.clamp();
+
+ // create shadow sequence
+ drawinglayer::primitive2d::Primitive2DSequence aShadows(2);
+ basegfx::B2DHomMatrix aTransform;
+
+ aTransform.set(0, 2, -getDiscreteUnit());
+ aTransform.set(1, 2, -getDiscreteUnit());
+
+ aShadows[0] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::ShadowPrimitive2D(
+ aTransform,
+ aLighterColor,
+ aRetval));
+
+ aTransform.set(0, 2, getDiscreteUnit());
+ aTransform.set(1, 2, getDiscreteUnit());
+
+ aShadows[1] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::ShadowPrimitive2D(
+ aTransform,
+ aDarkerColor,
+ aRetval));
+
+ // add shadow before geometry to make it be proccessed first
+ const drawinglayer::primitive2d::Primitive2DSequence aTemporary(aRetval);
+
+ aRetval = aShadows;
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemporary);
+ }
+
+ if ( AS_ALL == maAnchorState ||
+ AS_END == maAnchorState )
+ {
+ // LineTop has to be created, too, but uses no shadow, so add after
+ // the other parts are created
+ const drawinglayer::attribute::LineAttribute aLineAttribute(
+ getColor(),
+ getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit()));
+
+ const drawinglayer::primitive2d::Primitive2DReference aLineTop(
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ getLineTop(),
+ aLineAttribute));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aLineTop);
+ }
+
+ return aRetval;
+}
+
+bool AnchorPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const
+{
+ if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const AnchorPrimitive& rCompare = static_cast< const AnchorPrimitive& >(rPrimitive);
+
+ return (getTriangle() == rCompare.getTriangle()
+ && getLine() == rCompare.getLine()
+ && getLineTop() == rCompare.getLineTop()
+ && getAnchorState() == rCompare.getAnchorState()
+ && getColor() == rCompare.getColor()
+ && getLogicLineWidth() == rCompare.getLogicLineWidth()
+ && getShadow() == rCompare.getShadow()
+ && getLineSolid() == rCompare.getLineSolid());
+ }
+
+ return false;
+}
+
+ImplPrimitrive2DIDBlock(AnchorPrimitive, PRIMITIVE2D_ID_SWSIDEBARANCHORPRIMITIVE)
+
+/****** AnchorOverlayObject ***********************************************************/
+/*static*/ AnchorOverlayObject* AnchorOverlayObject::CreateAnchorOverlayObject(
+ SwView& rDocView,
+ const SwRect& aAnchorRect,
+ const long& aPageBorder,
+ const Point& aLineStart,
+ const Point& aLineEnd,
+ const Color& aColorAnchor )
+{
+ AnchorOverlayObject* pAnchorOverlayObject( 0 );
+ if ( rDocView.GetDrawView() )
+ {
+ SdrPaintWindow* pPaintWindow = rDocView.GetDrawView()->GetPaintWindow(0);
+ if( pPaintWindow )
+ {
+ sdr::overlay::OverlayManager* pOverlayManager = pPaintWindow->GetOverlayManager();
+
+ if ( pOverlayManager )
+ {
+ pAnchorOverlayObject = new AnchorOverlayObject(
+ basegfx::B2DPoint( aAnchorRect.Left() , aAnchorRect.Bottom()-5*15),
+ basegfx::B2DPoint( aAnchorRect.Left()-5*15 , aAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( aAnchorRect.Left()+5*15 , aAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( aAnchorRect.Left(), aAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( aPageBorder ,aAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
+ basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()) ,
+ aColorAnchor,
+ false,
+ false);
+ pOverlayManager->add(*pAnchorOverlayObject);
+ }
+ }
+ }
+
+ return pAnchorOverlayObject;
+}
+
+/*static*/ void AnchorOverlayObject::DestroyAnchorOverlayObject( AnchorOverlayObject* pAnchor )
+{
+ if ( pAnchor )
+ {
+ if ( pAnchor->getOverlayManager() )
+ {
+ // remove this object from the chain
+ pAnchor->getOverlayManager()->remove(*pAnchor);
+ }
+ delete pAnchor;
+ }
+}
+
+AnchorOverlayObject::AnchorOverlayObject( const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPos,
+ const basegfx::B2DPoint& rThirdPos,
+ const basegfx::B2DPoint& rFourthPos,
+ const basegfx::B2DPoint& rFifthPos,
+ const basegfx::B2DPoint& rSixthPos,
+ const basegfx::B2DPoint& rSeventhPos,
+ const Color aBaseColor,
+ const bool bShadowedEffect,
+ const bool bLineSolid)
+ : OverlayObjectWithBasePosition( rBasePos, aBaseColor )
+ , maSecondPosition(rSecondPos)
+ , maThirdPosition(rThirdPos)
+ , maFourthPosition(rFourthPos)
+ , maFifthPosition(rFifthPos)
+ , maSixthPosition(rSixthPos)
+ , maSeventhPosition(rSeventhPos)
+ , maTriangle()
+ , maLine()
+ , maLineTop()
+ , mHeight(0)
+ , mAnchorState(AS_ALL)
+ , mbShadowedEffect(bShadowedEffect)
+ , mbLineSolid(bLineSolid)
+{
+}
+
+AnchorOverlayObject::~AnchorOverlayObject()
+{
+}
+
+void AnchorOverlayObject::implEnsureGeometry()
+{
+ if(!maTriangle.count())
+ {
+ maTriangle.append(getBasePosition());
+ maTriangle.append(GetSecondPosition());
+ maTriangle.append(GetThirdPosition());
+ maTriangle.setClosed(true);
+ }
+
+ if(!maLine.count())
+ {
+ maLine.append(GetFourthPosition());
+ maLine.append(GetFifthPosition());
+ maLine.append(GetSixthPosition());
+ }
+
+ if(!maLineTop.count())
+ {
+ maLineTop.append(GetSixthPosition());
+ maLineTop.append(GetSeventhPosition());
+ }
+}
+
+void AnchorOverlayObject::implResetGeometry()
+{
+ maTriangle.clear();
+ maLine.clear();
+ maLineTop.clear();
+}
+
+drawinglayer::primitive2d::Primitive2DSequence AnchorOverlayObject::createOverlayObjectPrimitive2DSequence()
+{
+ implEnsureGeometry();
+
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new AnchorPrimitive( maTriangle,
+ maLine,
+ maLineTop,
+ GetAnchorState(),
+ getBaseColor().getBColor(),
+ ANCHORLINE_WIDTH * 15.0,
+ getShadowedEffect(),
+ getLineSolid()) );
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+}
+
+void AnchorOverlayObject::SetAllPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2,
+ const basegfx::B2DPoint& rPoint3,
+ const basegfx::B2DPoint& rPoint4,
+ const basegfx::B2DPoint& rPoint5,
+ const basegfx::B2DPoint& rPoint6,
+ const basegfx::B2DPoint& rPoint7)
+{
+ if ( rPoint1 != getBasePosition() ||
+ rPoint2 != GetSecondPosition() ||
+ rPoint3 != GetThirdPosition() ||
+ rPoint4 != GetFourthPosition() ||
+ rPoint5 != GetFifthPosition() ||
+ rPoint6 != GetSixthPosition() ||
+ rPoint7 != GetSeventhPosition() )
+ {
+ maBasePosition = rPoint1;
+ maSecondPosition = rPoint2;
+ maThirdPosition = rPoint3;
+ maFourthPosition = rPoint4;
+ maFifthPosition = rPoint5;
+ maSixthPosition = rPoint6;
+ maSeventhPosition = rPoint7;
+
+ implResetGeometry();
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::SetSixthPosition(const basegfx::B2DPoint& rNew)
+{
+ if(rNew != maSixthPosition)
+ {
+ maSixthPosition = rNew;
+ implResetGeometry();
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::SetSeventhPosition(const basegfx::B2DPoint& rNew)
+{
+ if(rNew != maSeventhPosition)
+ {
+ maSeventhPosition = rNew;
+ implResetGeometry();
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::SetTriPosition(const basegfx::B2DPoint& rPoint1,const basegfx::B2DPoint& rPoint2,const basegfx::B2DPoint& rPoint3,
+ const basegfx::B2DPoint& rPoint4,const basegfx::B2DPoint& rPoint5)
+{
+ if(rPoint1 != getBasePosition()
+ || rPoint2 != GetSecondPosition()
+ || rPoint3 != GetThirdPosition()
+ || rPoint4 != GetFourthPosition()
+ || rPoint5 != GetFifthPosition())
+ {
+ maBasePosition = rPoint1;
+ maSecondPosition = rPoint2;
+ maThirdPosition = rPoint3;
+ maFourthPosition = rPoint4;
+ maFifthPosition = rPoint5;
+
+ implResetGeometry();
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::setLineSolid( const bool bNew )
+{
+ if ( bNew != getLineSolid() )
+ {
+ mbLineSolid = bNew;
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::SetAnchorState( const AnchorState aState)
+{
+ if ( mAnchorState != aState)
+ {
+ mAnchorState = aState;
+ objectChange();
+ }
+}
+
+} } // end of namespace sw::annotation
+
diff --git a/sw/source/ui/docvw/AnchorOverlayObject.hxx b/sw/source/ui/docvw/AnchorOverlayObject.hxx
new file mode 100644
index 000000000000..cea567f22921
--- /dev/null
+++ b/sw/source/ui/docvw/AnchorOverlayObject.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ANCHOROVERLAYOBJECT_HXX
+#define _ANCHOROVERLAYOBJECT_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+class SwView;
+class SwRect;
+class Point;
+
+namespace sw { namespace sidebarwindows {
+
+enum AnchorState
+{
+ AS_ALL,
+ AS_START,
+ AS_END,
+ AS_TRI
+};
+
+class AnchorOverlayObject: public sdr::overlay::OverlayObjectWithBasePosition
+{
+ public:
+ static AnchorOverlayObject* CreateAnchorOverlayObject( SwView& rDocView,
+ const SwRect& aAnchorRect,
+ const long& aPageBorder,
+ const Point& aLineStart,
+ const Point& aLineEnd,
+ const Color& aColorAnchor );
+ static void DestroyAnchorOverlayObject( AnchorOverlayObject* pAnchor );
+
+ inline const basegfx::B2DPoint& GetSecondPosition() const { return maSecondPosition; }
+ const basegfx::B2DPoint& GetThirdPosition() const { return maThirdPosition; }
+ const basegfx::B2DPoint& GetFourthPosition() const { return maFourthPosition; }
+ const basegfx::B2DPoint& GetFifthPosition() const { return maFifthPosition; }
+ const basegfx::B2DPoint& GetSixthPosition() const { return maSixthPosition; }
+ const basegfx::B2DPoint& GetSeventhPosition() const { return maSeventhPosition; }
+
+ void SetAllPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2,
+ const basegfx::B2DPoint& rPoint3,
+ const basegfx::B2DPoint& rPoint4,
+ const basegfx::B2DPoint& rPoint5,
+ const basegfx::B2DPoint& rPoint6,
+ const basegfx::B2DPoint& rPoint7 );
+ void SetTriPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2,
+ const basegfx::B2DPoint& rPoint3,
+ const basegfx::B2DPoint& rPoint4,
+ const basegfx::B2DPoint& rPoint5 );
+ void SetSixthPosition( const basegfx::B2DPoint& rNew );
+ void SetSeventhPosition( const basegfx::B2DPoint& rNew );
+
+ void setLineSolid( const bool bNew );
+ inline bool getLineSolid() const { return mbLineSolid; }
+
+ inline void SetHeight( const unsigned long aHeight ) { mHeight = aHeight; };
+
+ bool getShadowedEffect() const { return mbShadowedEffect; }
+
+ void SetAnchorState( const AnchorState aState );
+ inline AnchorState GetAnchorState() const { return mAnchorState; }
+
+ protected:
+ /* 6------------7
+ 1 /
+ /4\ ---------------5
+ 2 - 3
+ */
+
+ basegfx::B2DPoint maSecondPosition;
+ basegfx::B2DPoint maThirdPosition;
+ basegfx::B2DPoint maFourthPosition;
+ basegfx::B2DPoint maFifthPosition;
+ basegfx::B2DPoint maSixthPosition;
+ basegfx::B2DPoint maSeventhPosition;
+
+ // helpers to fill and reset geometry
+ void implEnsureGeometry();
+ void implResetGeometry();
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ private:
+ // object's geometry
+ basegfx::B2DPolygon maTriangle;
+ basegfx::B2DPolygon maLine;
+ basegfx::B2DPolygon maLineTop;
+ unsigned long mHeight;
+ AnchorState mAnchorState;
+
+ bool mbShadowedEffect : 1;
+ bool mbLineSolid : 1;
+
+ AnchorOverlayObject( const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPos,
+ const basegfx::B2DPoint& rThirdPos,
+ const basegfx::B2DPoint& rFourthPos,
+ const basegfx::B2DPoint& rFifthPos,
+ const basegfx::B2DPoint& rSixthPos,
+ const basegfx::B2DPoint& rSeventhPos,
+ const Color aBaseColor,
+ const bool bShadowedEffect,
+ const bool bLineSolid );
+ virtual ~AnchorOverlayObject();
+};
+
+} } // end of namespace sw::annotation
+
+#endif
diff --git a/sw/source/ui/docvw/AnnotationMenuButton.cxx b/sw/source/ui/docvw/AnnotationMenuButton.cxx
new file mode 100644
index 000000000000..6022a4646ae6
--- /dev/null
+++ b/sw/source/ui/docvw/AnnotationMenuButton.cxx
@@ -0,0 +1,222 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <AnnotationMenuButton.hxx>
+
+#include <annotation.hrc>
+#include <app.hrc>
+#include <access.hrc>
+
+#include <unotools/useroptions.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/decoview.hxx>
+#include <vcl/gradient.hxx>
+
+#include <cmdid.h>
+#include <SidebarWin.hxx>
+
+namespace sw { namespace annotation {
+
+Color ColorFromAlphaColor( const UINT8 aTransparency,
+ const Color &aFront,
+ const Color &aBack )
+{
+ return Color((UINT8)(aFront.GetRed() * aTransparency/(double)255 + aBack.GetRed() * (1-aTransparency/(double)255)),
+ (UINT8)(aFront.GetGreen() * aTransparency/(double)255 + aBack.GetGreen() * (1-aTransparency/(double)255)),
+ (UINT8)(aFront.GetBlue() * aTransparency/(double)255 + aBack.GetBlue() * (1-aTransparency/(double)255)));
+}
+
+AnnotationMenuButton::AnnotationMenuButton( sw::sidebarwindows::SwSidebarWin& rSidebarWin )
+ : MenuButton( &rSidebarWin )
+ , mrSidebarWin( rSidebarWin )
+{
+ AddEventListener( LINK( &mrSidebarWin, sw::sidebarwindows::SwSidebarWin, WindowEventListener ) );
+
+ SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_BUTTON_NAME ) );
+ SetAccessibleDescription( SW_RES( STR_ACCESS_ANNOTATION_BUTTON_DESC ) );
+ SetQuickHelpText( GetAccessibleDescription() );
+}
+
+AnnotationMenuButton::~AnnotationMenuButton()
+{
+ RemoveEventListener( LINK( &mrSidebarWin, sw::sidebarwindows::SwSidebarWin, WindowEventListener ) );
+}
+
+void AnnotationMenuButton::Select()
+{
+ mrSidebarWin.ExecuteCommand( GetCurItemId() );
+}
+
+void AnnotationMenuButton::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ PopupMenu* pButtonPopup( GetPopupMenu() );
+ if ( mrSidebarWin.IsReadOnly() )
+ {
+ pButtonPopup->EnableItem( FN_REPLY, false );
+ pButtonPopup->EnableItem( FN_DELETE_NOTE, false );
+ pButtonPopup->EnableItem( FN_DELETE_NOTE_AUTHOR, false );
+ pButtonPopup->EnableItem( FN_DELETE_ALL_NOTES, false );
+ }
+ else
+ {
+ if ( mrSidebarWin.IsProtected() )
+ {
+ pButtonPopup->EnableItem( FN_DELETE_NOTE, false );
+ }
+ else
+ {
+ pButtonPopup->EnableItem( FN_DELETE_NOTE, true );
+ }
+ pButtonPopup->EnableItem( FN_DELETE_NOTE_AUTHOR, true );
+ pButtonPopup->EnableItem( FN_DELETE_ALL_NOTES, true );
+ }
+
+ if ( mrSidebarWin.IsProtected() )
+ {
+ pButtonPopup->EnableItem( FN_REPLY, false );
+ }
+ else
+ {
+ SvtUserOptions aUserOpt;
+ String sAuthor;
+ if ( !(sAuthor = aUserOpt.GetFullName()).Len() )
+ {
+ if ( !(sAuthor = aUserOpt.GetID()).Len() )
+ {
+ sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
+ }
+ }
+ // do not allow to reply to ourself and no answer possible if this note is in a protected section
+ if ( sAuthor == mrSidebarWin.GetAuthor() )
+ {
+ pButtonPopup->EnableItem( FN_REPLY, false );
+ }
+ else
+ {
+ pButtonPopup->EnableItem( FN_REPLY, true );
+ }
+ }
+
+ MenuButton::MouseButtonDown( rMEvt );
+}
+
+void AnnotationMenuButton::Paint( const Rectangle& /*rRect*/ )
+{
+ if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ SetFillColor(COL_BLACK);
+ else
+ SetFillColor( mrSidebarWin.ColorDark() );
+ SetLineColor();
+ const Rectangle aRect( Rectangle( Point( 0, 0 ), PixelToLogic( GetSizePixel() ) ) );
+ DrawRect( aRect );
+
+ if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ //draw rect around button
+ SetFillColor(COL_BLACK);
+ SetLineColor(COL_WHITE);
+ }
+ else
+ {
+ //draw button
+ Gradient aGradient;
+ if ( IsMouseOver() )
+ aGradient = Gradient( GRADIENT_LINEAR,
+ ColorFromAlphaColor( 80, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ),
+ ColorFromAlphaColor( 15, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ));
+ else
+ aGradient = Gradient( GRADIENT_LINEAR,
+ ColorFromAlphaColor( 15, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ),
+ ColorFromAlphaColor( 80, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ));
+ DrawGradient( aRect, aGradient );
+
+ //draw rect around button
+ SetFillColor();
+ SetLineColor( ColorFromAlphaColor( 90, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ));
+ }
+ DrawRect( aRect );
+
+ if ( mrSidebarWin.IsPreview() )
+ {
+ Font aOldFont( mrSidebarWin.GetFont() );
+ Font aFont(aOldFont);
+ Color aCol( COL_BLACK);
+ aFont.SetColor( aCol );
+ aFont.SetHeight(200);
+ aFont.SetWeight(WEIGHT_MEDIUM);
+ SetFont( aFont );
+ DrawText( aRect ,
+ rtl::OUString::createFromAscii("Edit Note"),
+ TEXT_DRAW_CENTER );
+ SetFont( aOldFont );
+ }
+ else
+ {
+ Rectangle aSymbolRect( aRect );
+ // 25% distance to the left and right button border
+ const long nBorderDistanceLeftAndRight = ((aSymbolRect.GetWidth()*250)+500)/1000;
+ aSymbolRect.Left()+=nBorderDistanceLeftAndRight;
+ aSymbolRect.Right()-=nBorderDistanceLeftAndRight;
+ // 40% distance to the top button border
+ const long nBorderDistanceTop = ((aSymbolRect.GetHeight()*400)+500)/1000;
+ aSymbolRect.Top()+=nBorderDistanceTop;
+ // 15% distance to the bottom button border
+ const long nBorderDistanceBottom = ((aSymbolRect.GetHeight()*150)+500)/1000;
+ aSymbolRect.Bottom()-=nBorderDistanceBottom;
+ DecorationView aDecoView( this );
+ aDecoView.DrawSymbol( aSymbolRect, SYMBOL_SPIN_DOWN,
+ ( Application::GetSettings().GetStyleSettings().GetHighContrastMode()
+ ? Color( COL_WHITE )
+ : Color( COL_BLACK ) ) );
+ }
+}
+
+void AnnotationMenuButton::KeyInput( const KeyEvent& rKeyEvt )
+{
+ const KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
+ const USHORT nKey = rKeyCode.GetCode();
+ if ( nKey == KEY_TAB )
+ {
+ mrSidebarWin.ActivatePostIt();
+ mrSidebarWin.GrabFocus();
+ }
+ else
+ {
+ MenuButton::KeyInput( rKeyEvt );
+ }
+}
+
+} } // end of namespace sw::annotation
+
diff --git a/sw/source/ui/docvw/AnnotationMenuButton.hxx b/sw/source/ui/docvw/AnnotationMenuButton.hxx
new file mode 100644
index 000000000000..c74719f1cad4
--- /dev/null
+++ b/sw/source/ui/docvw/AnnotationMenuButton.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ANNOTATIONMENUBUTTON_HXX
+#define _ANNOTATIONMENUBUTTON_HXX
+
+#include <vcl/menubtn.hxx>
+
+namespace sw { namespace sidebarwindows {
+ class SwSidebarWin;
+} }
+
+namespace sw { namespace annotation {
+
+class AnnotationMenuButton : public MenuButton
+{
+ public:
+ AnnotationMenuButton( sw::sidebarwindows::SwSidebarWin& rSidebarWin );
+ ~AnnotationMenuButton();
+
+ // overloaded <MenuButton> methods
+ virtual void Select();
+
+ // overloaded <Window> methods
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void KeyInput( const KeyEvent& rKeyEvt );
+
+ private:
+ sw::sidebarwindows::SwSidebarWin& mrSidebarWin;
+};
+
+} } // end of namespace sw::annotation
+
+#endif
diff --git a/sw/source/ui/docvw/AnnotationWin.cxx b/sw/source/ui/docvw/AnnotationWin.cxx
new file mode 100644
index 000000000000..91ea1e13b077
--- /dev/null
+++ b/sw/source/ui/docvw/AnnotationWin.cxx
@@ -0,0 +1,292 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <AnnotationWin.hxx>
+
+#include <AnnotationMenuButton.hxx>
+#include <PostItMgr.hxx>
+
+#include <annotation.hrc>
+#include <popup.hrc>
+#include <cmdid.h>
+
+#include <vcl/menu.hxx>
+
+#include <svl/undo.hxx>
+#include <unotools/syslocale.hxx>
+#include <svl/languageoptions.hxx>
+
+#include <editeng/postitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/langitem.hxx>
+
+#include <editeng/editview.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editobj.hxx>
+
+#include <docufld.hxx> // SwPostItField
+#include <txtfld.hxx>
+#include <ndtxt.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <doc.hxx>
+#include <SwUndoField.hxx>
+
+namespace sw { namespace annotation {
+
+SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits,
+ SwSidebarItem& rSidebarItem,
+ SwFmtFld* aField )
+ : SwSidebarWin( rEditWin, nBits, aMgr, aBits, rSidebarItem )
+ , mpFmtFld(aField)
+ , mpFld( static_cast<SwPostItField*>(aField->GetFld()))
+ , mpButtonPopup(0)
+{
+}
+
+SwAnnotationWin::~SwAnnotationWin()
+{
+ delete mpButtonPopup;
+}
+
+void SwAnnotationWin::SetPostItText()
+{
+ // get text from SwPostItField and insert into our textview
+ Engine()->SetModifyHdl( Link() );
+ Engine()->EnableUndo( FALSE );
+ mpFld = static_cast<SwPostItField*>(mpFmtFld->GetFld());
+ if( mpFld->GetTextObject() )
+ Engine()->SetText( *mpFld->GetTextObject() );
+ else
+ {
+ Engine()->Clear();
+ GetOutlinerView()->SetAttribs(DefaultItem());
+ GetOutlinerView()->InsertText(mpFld->GetPar2(),false);
+ }
+
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+ Engine()->EnableUndo( TRUE );
+ Engine()->SetModifyHdl( LINK( this, SwAnnotationWin, ModifyHdl ) );
+ Invalidate();
+}
+
+void SwAnnotationWin::UpdateData()
+{
+ if ( Engine()->IsModified() )
+ {
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+ SwField* pOldField = mpFld->Copy();
+ mpFld->SetPar2(Engine()->GetEditEngine().GetText());
+ mpFld->SetTextObject(Engine()->CreateParaObject());
+ DocView().GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
+ delete pOldField;
+ // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one)
+ Mgr().SetLayout();
+ // #i98686# if we have several views, all notes should update their text
+ mpFmtFld->Broadcast(SwFmtFldHint( 0, SWFMTFLD_CHANGED));
+ DocView().GetDocShell()->SetModified();
+ }
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+}
+
+void SwAnnotationWin::Delete()
+{
+ SwSidebarWin::Delete();
+ // we delete the field directly, the Mgr cleans up the PostIt by listening
+ DocView().GetWrtShellPtr()->GotoField(*mpFmtFld);
+ GrabFocusToDocument();
+ DocView().GetWrtShellPtr()->DelRight();
+}
+
+void SwAnnotationWin::GotoPos()
+{
+ DocView().GetDocShell()->GetWrtShell()->GotoField(*mpFmtFld);
+}
+
+sal_uInt32 SwAnnotationWin::MoveCaret()
+{
+ // if this is an answer, do not skip over all following ones, but insert directly behind the current one
+ // but when just leaving a note, skip all following ones as well to continue typing
+ return Mgr().IsAnswer()
+ ? 1
+ : 1 + CountFollowing();
+}
+
+//returns true, if there is another note right before this note
+bool SwAnnotationWin::CalcFollow()
+{
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+ SwTxtAttr * const pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
+ aPosition.nContent.GetIndex() - 1, RES_TXTATR_FIELD );
+ const SwField* pFld = pTxtAttr ? pTxtAttr->GetFld().GetFld() : 0;
+ return pFld && (pFld->Which()== RES_POSTITFLD);
+}
+
+// counts how many SwPostItField we have right after the current one
+sal_uInt32 SwAnnotationWin::CountFollowing()
+{
+ sal_uInt32 aCount = 1; // we start with 1, so we have to subtract one at the end again
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+
+ SwTxtAttr * pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
+ aPosition.nContent.GetIndex() + 1,
+ RES_TXTATR_FIELD );
+ SwField* pFld = pTxtAttr
+ ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld())
+ : 0;
+ while ( pFld && ( pFld->Which()== RES_POSTITFLD ) )
+ {
+ aCount++;
+ pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
+ aPosition.nContent.GetIndex() + aCount,
+ RES_TXTATR_FIELD );
+ pFld = pTxtAttr
+ ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld())
+ : 0;
+ }
+ return aCount - 1;
+}
+
+MenuButton* SwAnnotationWin::CreateMenuButton()
+{
+ mpButtonPopup = new PopupMenu(SW_RES(MN_ANNOTATION_BUTTON));
+ XubString aText = mpButtonPopup->GetItemText( FN_DELETE_NOTE_AUTHOR );
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1,GetAuthor());
+ aText = aRewriter.Apply(aText);
+ mpButtonPopup->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
+ MenuButton* pMenuButton = new AnnotationMenuButton( *this );
+ pMenuButton->SetPopupMenu( mpButtonPopup );
+ pMenuButton->Show();
+ return pMenuButton;
+}
+
+void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText)
+{
+ //collect our old meta data
+ SwSidebarWin* pWin = Mgr().GetNextPostIt(KEY_PAGEUP, this);
+ const LocaleDataWrapper& rLocalData = SvtSysLocale().GetLocaleData();
+ String aText = String(SW_RES(STR_REPLY));
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, pWin->GetAuthor());
+ aText = aRewriter.Apply(aText);
+ aText.Append(String(rtl::OUString::createFromAscii(" (") +
+ String(rLocalData.getDate( pWin->GetDate())) + rtl::OUString::createFromAscii(", ") +
+ String(rLocalData.getTime( pWin->GetTime(),false)) + rtl::OUString::createFromAscii("): \"")));
+ GetOutlinerView()->InsertText(aText,false);
+
+ // insert old, selected text or "..."
+ // TOOD: iterate over all paragraphs, not only first one to find out if it is empty
+ if (pText->GetTextObject().GetText(0) != String(rtl::OUString::createFromAscii("")))
+ GetOutlinerView()->GetEditView().InsertText(pText->GetTextObject());
+ else
+ GetOutlinerView()->InsertText(rtl::OUString::createFromAscii("..."),false);
+ GetOutlinerView()->InsertText(rtl::OUString::createFromAscii("\"\n"),false);
+
+ GetOutlinerView()->SetSelection(ESelection(0x0,0x0,0xFFFF,0xFFFF));
+ SfxItemSet aAnswerSet( DocView().GetDocShell()->GetPool() );
+ aAnswerSet.Put(SvxFontHeightItem(200,80,EE_CHAR_FONTHEIGHT));
+ aAnswerSet.Put(SvxPostureItem(ITALIC_NORMAL,EE_CHAR_ITALIC));
+ GetOutlinerView()->SetAttribs(aAnswerSet);
+ GetOutlinerView()->SetSelection(ESelection(0xFFFF,0xFFFF,0xFFFF,0xFFFF));
+
+ //remove all attributes and reset our standard ones
+ GetOutlinerView()->GetEditView().RemoveAttribsKeepLanguages(true);
+ GetOutlinerView()->SetAttribs(DefaultItem());
+ // lets insert an undo step so the initial text can be easily deleted
+ // but do not use UpdateData() directly, would set modified state again and reentrance into Mgr
+ Engine()->SetModifyHdl( Link() );
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+ SwField* pOldField = mpFld->Copy();
+ mpFld->SetPar2(Engine()->GetEditEngine().GetText());
+ mpFld->SetTextObject(Engine()->CreateParaObject());
+ DocView().GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
+ delete pOldField;
+ Engine()->SetModifyHdl( LINK( this, SwAnnotationWin, ModifyHdl ) );
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+}
+
+SvxLanguageItem SwAnnotationWin::GetLanguage(void)
+{
+ // set initial language for outliner
+ USHORT nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( mpFld->GetLanguage() );
+ USHORT nLangWhichId = 0;
+ switch (nScriptType)
+ {
+ case SCRIPTTYPE_LATIN : nLangWhichId = EE_CHAR_LANGUAGE ; break;
+ case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
+ case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
+ default: DBG_ERROR("GetLanguage: wrong script tye");
+ }
+ return SvxLanguageItem(mpFld->GetLanguage(),nLangWhichId);
+}
+
+bool SwAnnotationWin::IsProtected()
+{
+ return SwSidebarWin::IsProtected() ||
+ GetLayoutStatus() == SwPostItHelper::DELETED ||
+ ( mpFmtFld ? mpFmtFld->IsProtect() : false );
+}
+
+String SwAnnotationWin::GetAuthor()
+{
+ return mpFld->GetPar1();
+}
+
+Date SwAnnotationWin::GetDate()
+{
+ return mpFld->GetDate();
+}
+
+Time SwAnnotationWin::GetTime()
+{
+ return mpFld->GetTime();
+}
+
+} } // end of namespace sw::annotation
diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx
index 25adc5006c4d..c6b0ad4a136f 100644
--- a/sw/source/ui/docvw/PostItMgr.cxx
+++ b/sw/source/ui/docvw/PostItMgr.cxx
@@ -31,6 +31,15 @@
#include "PostItMgr.hxx"
#include <postithelper.hxx>
+#include <SidebarWin.hxx>
+#include <AnnotationWin.hxx>
+#include <frmsidebarwincontainer.hxx>
+#include <accmap.hxx>
+
+#include <SidebarWindowsConsts.hxx>
+#include <AnchorOverlayObject.hxx>
+#include <ShadowOverlayObject.hxx>
+
#include <vcl/svapp.hxx>
#include <vcl/scrbar.hxx>
#include <vcl/outdev.hxx>
@@ -45,7 +54,6 @@
#include <fmtfld.hxx>
#include <docufld.hxx>
#include <edtwin.hxx>
-#include <postit.hxx>
#include <txtfld.hxx>
#include <ndtxt.hxx>
#include <redline.hxx>
@@ -55,7 +63,7 @@
#include <tools/color.hxx>
#include <swmodule.hxx>
-#include <docvw.hrc>
+#include <annotation.hrc>
#include "cmdid.h"
#include <SwRewriter.hxx>
@@ -80,8 +88,8 @@
#include "swevent.hxx"
-// distance between ankor Y and initial note position
-#define POSTIT_INITIAL_ANKOR_DISTANCE 20
+// distance between Anchor Y and initial note position
+#define POSTIT_INITIAL_ANCHOR_DISTANCE 20
//distance between two postits
#define POSTIT_SPACE_BETWEEN 8
#define POSTIT_MINIMUMSIZE_WITH_META 60
@@ -90,6 +98,8 @@
// if we layout more often we stop, this should never happen
#define MAX_LOOP_COUNT 50
+using namespace sw::sidebarwindows;
+
/*
bool comp_author( const SwPostItItem* a, const SwPostItItem* b)
{
@@ -102,16 +112,22 @@ bool comp_date( const SwPostItItem* a, const SwPostItItem* b)
}
*/
-// if position is on the same line, sort by x (Left) position, otherwise by y(Bottom) position
-// if two notes are at the same position, sort by logical node position
-bool comp_pos(const SwMarginItem *a, const SwMarginItem *b)
+//
+bool comp_pos(const SwSidebarItem* a, const SwSidebarItem* b)
{
- return (a->mPos.Bottom() == b->mPos.Bottom()) ?
- ( ((a->mPos.Left() == b->mPos.Left()) && (a->GetBroadCaster()->ISA(SwFmtFld) && b->GetBroadCaster()->ISA(SwFmtFld)) ) ?
- *(static_cast<SwFmtFld*>(a->GetBroadCaster())->GetTxtFld()->GetStart()) <
- *(static_cast<SwFmtFld*>(b->GetBroadCaster())->GetTxtFld()->GetStart())
- : a->mPos.Left() < b->mPos.Left() )
- : a->mPos.Bottom() < b->mPos.Bottom();
+ // --> OD 2010-01-19 #i88070#
+ // sort by anchor position
+//// if position is on the same line, sort by x (Left) position, otherwise by y(Bottom) position
+//// if two notes are at the same position, sort by logical node position
+// return (a->maLayoutInfo.mPosition.Bottom() == b->maLayoutInfo.mPosition.Bottom())
+// ? ( ( (a->maLayoutInfo.mPosition.Left() == b->maLayoutInfo.mPosition.Left()) &&
+// (a->GetBroadCaster()->ISA(SwFmtFld) && b->GetBroadCaster()->ISA(SwFmtFld)) )
+// ? *(static_cast<SwFmtFld*>(a->GetBroadCaster())->GetTxtFld()->GetStart()) <
+// *(static_cast<SwFmtFld*>(b->GetBroadCaster())->GetTxtFld()->GetStart())
+// : a->maLayoutInfo.mPosition.Left() < b->maLayoutInfo.mPosition.Left() )
+// : a->maLayoutInfo.mPosition.Bottom() < b->maLayoutInfo.mPosition.Bottom();
+ return a->GetAnchorPosition() < b->GetAnchorPosition();
+ // <--
}
SwPostItMgr::SwPostItMgr(SwView* pView)
@@ -127,12 +143,14 @@ SwPostItMgr::SwPostItMgr(SwView* pView)
, mbReadOnly(mpView->GetDocShell()->IsReadOnly())
, mbDeleteNote(true)
, mpAnswer(0)
+ , mbIsShowAnchor( false )
+ , mpFrmSidebarWinContainer( 0 )
{
if(!mpView->GetDrawView() )
mpView->GetWrtShell().MakeDrawView();
SwNoteProps aProps;
- mpIsShowAnkor = aProps.IsShowAnkor();
+ mbIsShowAnchor = aProps.IsShowAnchor();
//make sure we get the colour yellow always, even if not the first one of comments or redlining
SW_MOD()->GetRedlineAuthor();
@@ -140,7 +158,7 @@ SwPostItMgr::SwPostItMgr(SwView* pView)
// collect all PostIts and redline comments that exist after loading the document
// don't check for existance for any of them, don't focus them
AddPostIts(false,false);
- /* this code can be used once we want redline comments in the margin
+ /* this code can be used once we want redline comments in the Sidebar
AddRedlineComments(false,false);
*/
// we want to receive stuff like SFX_HINT_DOCCHANGED
@@ -156,27 +174,30 @@ SwPostItMgr::~SwPostItMgr()
{
if ( mnEventId )
Application::RemoveUserEvent( mnEventId );
- // forget about all our margin windows
- RemoveMarginWin();
+ // forget about all our Sidebar windows
+ RemoveSidebarWin();
EndListening( *mpView->GetDocShell() );
for(std::vector<SwPostItPageItem*>::iterator i = mPages.begin(); i!= mPages.end() ; i++)
delete (*i);
mPages.clear();
+
+ delete mpFrmSidebarWinContainer;
+ mpFrmSidebarWinContainer = 0;
}
void SwPostItMgr::CheckForRemovedPostIts()
{
bool bRemoved = false;
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end(); )
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end(); )
{
- std::list<SwMarginItem*>::iterator it = i++;
+ std::list<SwSidebarItem*>::iterator it = i++;
if ( !(*it)->UseElement() )
{
- SwMarginItem* p = (*it);
+ SwSidebarItem* p = (*it);
mvPostItFlds.remove(*it);
- if (GetActivePostIt() == p->pPostIt)
- SetActivePostIt(0);
+ if (GetActiveSidebarWin() == p->pPostIt)
+ SetActiveSidebarWin(0);
if (p->pPostIt)
delete p->pPostIt;
delete p;
@@ -204,7 +225,7 @@ void SwPostItMgr::InsertItem(SfxBroadcaster* pItem, bool bCheckExistance, bool b
{
if (bCheckExistance)
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ( (*i)->GetBroadCaster() == pItem )
return;
@@ -212,7 +233,7 @@ void SwPostItMgr::InsertItem(SfxBroadcaster* pItem, bool bCheckExistance, bool b
}
mbLayout = bFocus;
if (pItem->ISA(SwFmtFld))
- mvPostItFlds.push_back(new SwPostItItem(static_cast<SwFmtFld*>(pItem), true, bFocus) );
+ mvPostItFlds.push_back(new SwAnnotationItem(static_cast<SwFmtFld*>(pItem), true, bFocus) );
/*
else
if (pItem->ISA(SwRedline))
@@ -225,13 +246,13 @@ void SwPostItMgr::InsertItem(SfxBroadcaster* pItem, bool bCheckExistance, bool b
void SwPostItMgr::RemoveItem( SfxBroadcaster* pBroadcast )
{
EndListening(*pBroadcast);
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ( (*i)->GetBroadCaster() == pBroadcast )
{
- SwMarginItem* p = (*i);
- if (GetActivePostIt() == p->pPostIt)
- SetActivePostIt(0);
+ SwSidebarItem* p = (*i);
+ if (GetActiveSidebarWin() == p->pPostIt)
+ SetActiveSidebarWin(0);
mvPostItFlds.remove(*i);
delete p->pPostIt;
delete p;
@@ -379,7 +400,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
case SWFMTFLD_CHANGED:
{
SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC);
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ( pFmtFld == (*i)->GetBroadCaster() )
{
@@ -396,7 +417,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
case SWFMTFLD_LANGUAGE:
{
SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC);
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ( pFmtFld == (*i)->GetBroadCaster() )
{
@@ -410,7 +431,8 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
}
- (*i)->pPostIt->SetLanguage(SvxLanguageItem((*i)->GetFmtFld()->GetFld()->GetLanguage(),nLangWhichId));
+ (*i)->pPostIt->SetLanguage( SvxLanguageItem((*i)->GetFmtFld()->GetFld()->GetLanguage(),
+ nLangWhichId) );
}
break;
}
@@ -429,7 +451,7 @@ void SwPostItMgr::Focus(SfxBroadcaster& rBC)
mpView->ExecViewOptions(aRequest);
}
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
// field to get the focus is the broadcaster
if ( &rBC == (*i)->GetBroadCaster() )
@@ -463,9 +485,9 @@ bool SwPostItMgr::CalcRects()
PreparePageContainer();
if ( !mvPostItFlds.empty() )
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
- SwMarginItem* pItem = (*i);
+ SwSidebarItem* pItem = (*i);
if ( !pItem->UseElement() )
{
DBG_ERROR("PostIt is not in doc or other wrong use");
@@ -474,32 +496,30 @@ bool SwPostItMgr::CalcRects()
}
//save old rect and visible state
- SwRect aOldRect(pItem->mPos);
+ SwRect aOldRect(pItem->maLayoutInfo.mPosition);
SwPostItHelper::SwLayoutStatus eOldStatus = pItem->mLayoutStatus;
std::vector< SwLayoutInfo > aInfo;
- SwPosition aPosition = pItem->GetPosition();
- pItem->mLayoutStatus = SwPostItHelper::getLayoutInfos( aInfo, aPosition );
+ {
+ SwPosition aPosition = pItem->GetAnchorPosition();
+ pItem->mLayoutStatus = SwPostItHelper::getLayoutInfos( aInfo, aPosition );
+ }
if( aInfo.size() )
{
- SwLayoutInfo& rInfo = aInfo[0];
- pItem->mPos = rInfo.mPosition;
- pItem->mPagePos = rInfo.mPageFrame;
- pItem->mFramePos = rInfo.mPagePrtArea;
- pItem->bMarginSide = rInfo.mbMarginSide;
- pItem->mnPageNumber = rInfo.mnPageNumber;
- pItem->mRedlineAuthor = rInfo.mRedlineAuthor;
+ pItem->maLayoutInfo = aInfo[0];
}
- bChange = bChange || (pItem->mPos != aOldRect) || (eOldStatus != pItem->mLayoutStatus);
+ bChange = bChange ||
+ ( pItem->maLayoutInfo.mPosition != aOldRect ) ||
+ ( eOldStatus != pItem->mLayoutStatus );
}
// show notes in right order in navigator
- //prevent ankors during layout to overlap, e.g. when moving a frame
+ //prevent Anchors during layout to overlap, e.g. when moving a frame
Sort(SORT_POS);
// sort the items into the right page vector, so layout can be done by page
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
- SwMarginItem* pItem = (*i);
+ SwSidebarItem* pItem = (*i);
if( SwPostItHelper::INVISIBLE == pItem->mLayoutStatus )
{
if (pItem->pPostIt)
@@ -517,7 +537,7 @@ bool SwPostItMgr::CalcRects()
}
}
- const unsigned long aPageNum = pItem->mnPageNumber;
+ const unsigned long aPageNum = pItem->maLayoutInfo.mnPageNumber;
if (aPageNum > mPages.size())
{
const unsigned long nNumberOfPages = mPages.size();
@@ -525,8 +545,8 @@ bool SwPostItMgr::CalcRects()
mPages.push_back( new SwPostItPageItem());
}
mPages[aPageNum-1]->mList->push_back(pItem);
- mPages[aPageNum-1]->mPageRect = pItem->mPagePos;
- mPages[aPageNum-1]->bMarginSide = pItem->bMarginSide;
+ mPages[aPageNum-1]->mPageRect = pItem->maLayoutInfo.mPageFrame;
+ mPages[aPageNum-1]->eSidebarPosition = pItem->maLayoutInfo.meSidebarPosition;
}
if (!bChange && mpWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE))
@@ -555,9 +575,9 @@ bool SwPostItMgr::CalcRects()
bool SwPostItMgr::HasScrollbars() const
{
- for(std::list<SwMarginItem*>::const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
- if ((*i)->bShow && (*i)->pPostIt && (*i)->pPostIt->Scrollbar())
+ if ((*i)->bShow && (*i)->pPostIt && (*i)->pPostIt->HasScrollbar())
return true;
}
return false;
@@ -609,63 +629,80 @@ void SwPostItMgr::LayoutPostIts()
// only layout if there are notes on this page
if (mPages[n]->mList->size()>0)
{
- std::list<SwMarginWin*> aVisiblePostItList;
+ std::list<SwSidebarWin*> aVisiblePostItList;
unsigned long lNeededHeight = 0;
long mlPageBorder = 0;
long mlPageEnd = 0;
- for(SwMarginItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
+ for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
{
- SwMarginItem* pItem = (*i);
- SwMarginWin* pPostIt = pItem->pPostIt;
+ SwSidebarItem* pItem = (*i);
+ SwSidebarWin* pPostIt = pItem->pPostIt;
- if (mPages[n]->bMarginSide)
+ if (mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT )
{
// x value for notes positioning
mlPageBorder = mpEditWin->LogicToPixel( Point( mPages[n]->mPageRect.Left(), 0)).X() - GetSidebarWidth(true);// - GetSidebarBorderWidth(true);
//bending point
- mlPageEnd = mpWrtShell->getIDocumentSettingAccess()->get( IDocumentSettingAccess::BROWSE_MODE) ? pItem->mFramePos.Left() : mPages[n]->mPageRect.Left() + 350;
+ mlPageEnd =
+ mpWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE)
+ ? pItem->maLayoutInfo.mPagePrtArea.Left()
+ : mPages[n]->mPageRect.Left() + 350;
}
- else
+ else if (mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT )
{
// x value for notes positioning
mlPageBorder = mpEditWin->LogicToPixel( Point(mPages[n]->mPageRect.Right(), 0)).X() + GetSidebarBorderWidth(true);
//bending point
- mlPageEnd = mpWrtShell->getIDocumentSettingAccess()->get( IDocumentSettingAccess::BROWSE_MODE) ? pItem->mFramePos.Right() : mPages[n]->mPageRect.Right() - 350;
+ mlPageEnd =
+ mpWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE)
+ ? pItem->maLayoutInfo.mPagePrtArea.Right() :
+ mPages[n]->mPageRect.Right() - 350;
}
if (pItem->bShow)
{
- long Y = mpEditWin->LogicToPixel( Point(0,pItem->mPos.Bottom())).Y();
+ long Y = mpEditWin->LogicToPixel( Point(0,pItem->maLayoutInfo.mPosition.Bottom())).Y();
long aPostItHeight = 0;
if (!pPostIt)
{
- pPostIt = (*i)->GetMarginWindow(static_cast<Window*>(&mpView->GetEditWin()),WINDOW_CONTROL|WB_NODIALOGCONTROL,this,0);
+ pPostIt = (*i)->GetSidebarWindow( mpView->GetEditWin(),
+ WB_DIALOGCONTROL,
+ *this,
+ 0 );
pPostIt->InitControls();
pPostIt->SetReadonly(mbReadOnly);
pItem->pPostIt = pPostIt;
if (mpAnswer)
{
if (pPostIt->CalcFollow()) //do we really have another note in front of this one
- static_cast<SwPostIt*>(pPostIt)->InitAnswer(mpAnswer);
+ static_cast<sw::annotation::SwAnnotationWin*>(pPostIt)->InitAnswer(mpAnswer);
delete mpAnswer;
mpAnswer = 0;
}
}
- if (pItem->pPostIt->ISA(SwPostIt))
- {
- static_cast<SwPostIt*>(pPostIt)->SetChangeTracking(pItem->mLayoutStatus,GetColorAnkor(pItem->mRedlineAuthor));
- }
- pPostIt->SetMarginSide(mPages[n]->bMarginSide);
+ pPostIt->SetChangeTracking(
+ pItem->mLayoutStatus,
+ GetColorAnchor(pItem->maLayoutInfo.mRedlineAuthor));
+ pPostIt->SetSidebarPosition(mPages[n]->eSidebarPosition);
pPostIt->SetFollow(pPostIt->CalcFollow());
- aPostItHeight = ( pPostIt->GetPostItTextHeight() < pPostIt->GetMinimumSizeWithoutMeta() ? pPostIt->GetMinimumSizeWithoutMeta() : pPostIt->GetPostItTextHeight() ) + pPostIt->GetMetaHeight();
- pPostIt->SetPosSizePixelRect( mlPageBorder ,Y-GetInitialAnchorDistance(), GetNoteWidth() ,aPostItHeight,pItem->mPos, mlPageEnd);
+ aPostItHeight = ( pPostIt->GetPostItTextHeight() < pPostIt->GetMinimumSizeWithoutMeta()
+ ? pPostIt->GetMinimumSizeWithoutMeta()
+ : pPostIt->GetPostItTextHeight() )
+ + pPostIt->GetMetaHeight();
+ pPostIt->SetPosSizePixelRect( mlPageBorder ,
+ Y - GetInitialAnchorDistance(),
+ GetNoteWidth() ,
+ aPostItHeight,
+ pItem->maLayoutInfo.mPosition,
+ mlPageEnd );
+ pPostIt->ChangeSidebarItem( *pItem );
if (pItem->bFocus)
{
mbLayout = true;
- pPostIt->GrabFocus();
+ pPostIt->GrabFocus();
pItem->bFocus = false;
}
// only the visible postits are used for the final layout
@@ -705,7 +742,7 @@ void SwPostItMgr::LayoutPostIts()
- enlarge all notes till GetNextBorder(), as we resized to average value before
*/
//lets hide the ones which overlap the page
- for(SwMarginWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
{
if (mPages[n]->lOffset != 0)
(*i)->TranslateTopPosition(mPages[n]->lOffset);
@@ -720,24 +757,28 @@ void SwPostItMgr::LayoutPostIts()
{
if (mpEditWin->PixelToLogic(Point(0,(*i)->VirtualPos().Y())).Y() < (mPages[n]->mPageRect.Top()+aSidebarheight))
{
- if (mPages[n]->bMarginSide)
- (*i)->ShowAnkorOnly(Point(mPages[n]->mPageRect.Left(),mPages[n]->mPageRect.Top()));
- else
- (*i)->ShowAnkorOnly(Point(mPages[n]->mPageRect.Right(),mPages[n]->mPageRect.Top()));
+ if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT )
+ (*i)->ShowAnchorOnly(Point( mPages[n]->mPageRect.Left(),
+ mPages[n]->mPageRect.Top()));
+ else if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT )
+ (*i)->ShowAnchorOnly(Point( mPages[n]->mPageRect.Right(),
+ mPages[n]->mPageRect.Top()));
}
else
{
- if (mPages[n]->bMarginSide)
- (*i)->ShowAnkorOnly(Point(mPages[n]->mPageRect.Left(),mPages[n]->mPageRect.Bottom()));
- else
- (*i)->ShowAnkorOnly(Point(mPages[n]->mPageRect.Right(),mPages[n]->mPageRect.Bottom()));
+ if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT )
+ (*i)->ShowAnchorOnly(Point(mPages[n]->mPageRect.Left(),
+ mPages[n]->mPageRect.Bottom()));
+ else if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT )
+ (*i)->ShowAnchorOnly(Point(mPages[n]->mPageRect.Right(),
+ mPages[n]->mPageRect.Bottom()));
}
DBG_ASSERT(mPages[n]->bScrollbar,"SwPostItMgr::LayoutByPage(): note overlaps, but bScrollbar is not true");
}
}
// do some magic so we really see the focused note
- for(SwMarginWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
{
if ((*i)->HasChildPathFocus())
{
@@ -748,7 +789,7 @@ void SwPostItMgr::LayoutPostIts()
}
else
{
- for(SwMarginWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
(*i)->SetPosAndSize();
bool bOldScrollbar = mPages[n]->bScrollbar;
@@ -767,9 +808,9 @@ void SwPostItMgr::LayoutPostIts()
if (!ShowNotes())
{ // we do not want to see the notes anymore -> Options-Writer-View-Notes
bool bRepair = false;
- for(SwMarginItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
- SwMarginItem* pItem = (*i);
+ SwSidebarItem* pItem = (*i);
if ( !pItem->UseElement() )
{
DBG_ERROR("PostIt is not in doc!");
@@ -782,7 +823,7 @@ void SwPostItMgr::LayoutPostIts()
(*i)->pPostIt->HideNote();
if ((*i)->pPostIt->HasChildPathFocus())
{
- SetActivePostIt(0);
+ SetActiveSidebarWin(0);
(*i)->pPostIt->GrabFocusToDocument();
}
}
@@ -809,7 +850,7 @@ bool SwPostItMgr::BorderOverPageBorder(unsigned long aPage) const
return false;
}
- SwMarginItem_iterator aItem = mPages[aPage-1]->mList->end();
+ SwSidebarItem_iterator aItem = mPages[aPage-1]->mList->end();
--aItem;
DBG_ASSERT ((*aItem)->pPostIt,"BorderOverPageBorder: NULL postIt, should never happen");
if ((*aItem)->pPostIt)
@@ -832,9 +873,9 @@ void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage)
const bool bOldUp = ArrowEnabled(KEY_PAGEUP,aPage);
const bool bOldDown = ArrowEnabled(KEY_PAGEDOWN,aPage);
const long aSidebarheight = mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height();
- for(SwMarginItem_iterator i = mPages[aPage-1]->mList->begin(); i!= mPages[aPage-1]->mList->end(); i++)
+ for(SwSidebarItem_iterator i = mPages[aPage-1]->mList->begin(); i!= mPages[aPage-1]->mList->end(); i++)
{
- SwMarginWin* pPostIt = (*i)->pPostIt;
+ SwSidebarWin* pPostIt = (*i)->pPostIt;
// if this is an answer, we should take the normal position and not the real, slightly moved position
pPostIt->SetVirtualPosSize(pPostIt->GetPosPixel(),pPostIt->GetSizePixel());
pPostIt->TranslateTopPosition(lScroll);
@@ -851,17 +892,17 @@ void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage)
{
if ( mpEditWin->PixelToLogic(Point(0,pPostIt->VirtualPos().Y())).Y() < (mPages[aPage-1]->mPageRect.Top()+aSidebarheight))
{
- if (mPages[aPage-1]->bMarginSide)
- pPostIt->ShowAnkorOnly(Point(mPages[aPage-1]->mPageRect.Left(),mPages[aPage-1]->mPageRect.Top()));
- else
- pPostIt->ShowAnkorOnly(Point(mPages[aPage-1]->mPageRect.Right(),mPages[aPage-1]->mPageRect.Top()));
+ if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT)
+ pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Left(),mPages[aPage-1]->mPageRect.Top()));
+ else if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT)
+ pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Right(),mPages[aPage-1]->mPageRect.Top()));
}
else
{
- if (mPages[aPage-1]->bMarginSide)
- pPostIt->ShowAnkorOnly(Point(mPages[aPage-1]->mPageRect.Left(),mPages[aPage-1]->mPageRect.Bottom()));
- else
- pPostIt->ShowAnkorOnly(Point(mPages[aPage-1]->mPageRect.Right(),mPages[aPage-1]->mPageRect.Bottom()));
+ if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT)
+ pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Left(),mPages[aPage-1]->mPageRect.Bottom()));
+ else if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT)
+ pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Right(),mPages[aPage-1]->mPageRect.Bottom()));
}
}
}
@@ -874,7 +915,7 @@ void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage)
}
}
-void SwPostItMgr::AutoScroll(const SwMarginWin* pPostIt,const unsigned long aPage )
+void SwPostItMgr::AutoScroll(const SwSidebarWin* pPostIt,const unsigned long aPage )
{
// otherwise all notes are visible
if (mPages[aPage-1]->bScrollbar)
@@ -894,7 +935,7 @@ void SwPostItMgr::AutoScroll(const SwMarginWin* pPostIt,const unsigned long aPag
}
}
-void SwPostItMgr::MakeVisible(const SwMarginWin* pPostIt,long aPage )
+void SwPostItMgr::MakeVisible(const SwSidebarWin* pPostIt,long aPage )
{
if (aPage == -1)
{
@@ -903,7 +944,7 @@ void SwPostItMgr::MakeVisible(const SwMarginWin* pPostIt,long aPage )
{
if (mPages[n]->mList->size()>0)
{
- for(SwMarginItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
+ for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
{
if ((*i)->pPostIt==pPostIt)
{
@@ -952,7 +993,7 @@ Color SwPostItMgr::GetArrowColor(USHORT aDirection,unsigned long aPage) const
}
}
-bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const Rectangle aBorder, long lNeededHeight)
+bool SwPostItMgr::LayoutByPage(std::list<SwSidebarWin*> &aVisiblePostItList,const Rectangle aBorder, long lNeededHeight)
{
/*** General layout idea:***/
// - if we have space left, we always move the current one up,
@@ -982,12 +1023,12 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
bScrollbars = true;
lTopBorder += GetSidebarScrollerHeight() + 10;
lBottomBorder -= (GetSidebarScrollerHeight() + 10);
- for(SwMarginWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
(*i)->SetSize(Size((*i)->VirtualSize().getWidth(),(*i)->GetMinimumSizeWithMeta()));
}
else
{
- for(SwMarginWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
{
if ( (*i)->VirtualSize().getHeight() > lAverageHeight)
(*i)->SetSize(Size((*i)->VirtualSize().getWidth(),lAverageHeight));
@@ -1004,9 +1045,9 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
loop++;
bDone = true;
lSpaceUsed = lTopBorder + GetSpaceBetween();
- for(SwMarginWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
{
- SwMarginWin_iterator aNextPostIt = i;
+ SwSidebarWin_iterator aNextPostIt = i;
++aNextPostIt;
if (aNextPostIt !=aVisiblePostItList.end())
@@ -1025,7 +1066,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
if ( ((*i)->VirtualPos().Y()- lTranslatePos - GetSpaceBetween()) > lTopBorder)
{
if ((*aNextPostIt)->IsFollow())
- (*i)->TranslateTopPosition(-1*(lTranslatePos+ANKORLINE_WIDTH));
+ (*i)->TranslateTopPosition(-1*(lTranslatePos+ANCHORLINE_WIDTH));
else
(*i)->TranslateTopPosition(-1*(lTranslatePos+GetSpaceBetween()));
}
@@ -1034,7 +1075,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
long lMoveUp = (*i)->VirtualPos().Y() - lTopBorder;
(*i)->TranslateTopPosition(-1* lMoveUp);
if ((*aNextPostIt)->IsFollow())
- (*aNextPostIt)->TranslateTopPosition( (lTranslatePos+ANKORLINE_WIDTH) - lMoveUp);
+ (*aNextPostIt)->TranslateTopPosition( (lTranslatePos+ANCHORLINE_WIDTH) - lMoveUp);
else
(*aNextPostIt)->TranslateTopPosition( (lTranslatePos+GetSpaceBetween()) - lMoveUp);
}
@@ -1043,7 +1084,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
{
// no space left, left move the next one down
if ((*aNextPostIt)->IsFollow())
- (*aNextPostIt)->TranslateTopPosition(lTranslatePos+ANKORLINE_WIDTH);
+ (*aNextPostIt)->TranslateTopPosition(lTranslatePos+ANCHORLINE_WIDTH);
else
(*aNextPostIt)->TranslateTopPosition(lTranslatePos+GetSpaceBetween());
}
@@ -1062,14 +1103,14 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
}
}
if (aNextPostIt !=aVisiblePostItList.end() && (*aNextPostIt)->IsFollow())
- lSpaceUsed += (*i)->VirtualSize().Height() + ANKORLINE_WIDTH;
+ lSpaceUsed += (*i)->VirtualSize().Height() + ANCHORLINE_WIDTH;
else
lSpaceUsed += (*i)->VirtualSize().Height() + GetSpaceBetween();
}
else
{
//(*i) is the last visible item
- SwMarginWin_iterator aPrevPostIt = i;
+ SwSidebarWin_iterator aPrevPostIt = i;
--aPrevPostIt;
//lTranslatePos = ( (*aPrevPostIt)->VirtualPos().Y() + (*aPrevPostIt)->VirtualSize().Height() + GetSpaceBetween() ) - (*i)->VirtualPos().Y();
lTranslatePos = ( (*aPrevPostIt)->VirtualPos().Y() + (*aPrevPostIt)->VirtualSize().Height() ) - (*i)->VirtualPos().Y();
@@ -1079,7 +1120,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
if ( ((*i)->VirtualPos().Y()+ (*i)->VirtualSize().Height()+lTranslatePos) < lBottomBorder)
{
if ( (*i)->IsFollow() )
- (*i)->TranslateTopPosition(lTranslatePos+ANKORLINE_WIDTH);
+ (*i)->TranslateTopPosition(lTranslatePos+ANCHORLINE_WIDTH);
else
(*i)->TranslateTopPosition(lTranslatePos+GetSpaceBetween());
}
@@ -1111,7 +1152,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwMarginWin*> &aVisiblePostItList,const
else
{
// only one left, make sure it is not hidden at the top or bottom
- SwMarginWin_iterator i = aVisiblePostItList.begin();
+ SwSidebarWin_iterator i = aVisiblePostItList.begin();
lTranslatePos = lTopBorder - (*i)->VirtualPos().Y();
if (lTranslatePos>0)
{
@@ -1164,11 +1205,11 @@ void SwPostItMgr::AddPostIts(bool bCheckExistance, bool bFocus)
PrepareView(true);
}
-void SwPostItMgr::RemoveMarginWin()
+void SwPostItMgr::RemoveSidebarWin()
{
if (!mvPostItFlds.empty())
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
EndListening( *((*i)->GetBroadCaster()) );
if ((*i)->pPostIt)
@@ -1188,8 +1229,10 @@ void SwPostItMgr::RemoveMarginWin()
void SwPostItMgr::Delete(String aAuthor)
{
mpWrtShell->StartAllAction();
- if ( GetActivePostIt() && (GetActivePostIt()->GetAuthor()==aAuthor) )
- SetActivePostIt(0);
+ if ( HasActiveSidebarWin() && (GetActiveSidebarWin()->GetAuthor()==aAuthor) )
+ {
+ SetActiveSidebarWin(0);
+ }
SwRewriter aRewriter;
String aUndoString = SW_RES(STR_DELETE_AUTHOR_NOTES);
aUndoString += aAuthor;
@@ -1198,7 +1241,7 @@ void SwPostItMgr::Delete(String aAuthor)
std::vector<SwFmtFld*> aTmp;
aTmp.reserve( mvPostItFlds.size() );
- for(std::list<SwMarginItem*>::iterator pPostIt = mvPostItFlds.begin(); pPostIt!= mvPostItFlds.end() ; pPostIt++)
+ for(std::list<SwSidebarItem*>::iterator pPostIt = mvPostItFlds.begin(); pPostIt!= mvPostItFlds.end() ; pPostIt++)
{
if ((*pPostIt)->GetFmtFld() && ((*pPostIt)->pPostIt->GetAuthor() == aAuthor) )
aTmp.push_back( (*pPostIt)->GetFmtFld() );
@@ -1208,36 +1251,6 @@ void SwPostItMgr::Delete(String aAuthor)
mpWrtShell->GotoField( *(*i) );
mpWrtShell->DelRight();
}
- /*
- for(std::list<SwPostItItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end(); )
- {
- SwPostItItem* pItem = (*i);
- SwPostItField* pPostItField = static_cast<SwPostItField*>(pItem->pFmtFld->GetFld());
- if (pPostItField->GetPar1() == aAuthor)
- {
- // stop listening, we delete ourselves
- EndListening( *(pItem->pFmtFld) );
-
- // remove reference to yet-to-die postit
- if (pItem->pPostIt == GetActivePostIt())
- SetActivePostIt(0);
-
- // delete the actual SwPostItField
- mpWrtShell->GotoField(*pItem->pFmtFld);
- mpWrtShell->DelRight();
- i = mvPostItFlds.erase(i);
-
- // delete visual representation
- // lazy delete doesn't work because references to document (mpFmtFld, mpView etc. may be dead before deletion)
- delete pItem->pPostIt;
-
- // delete struct saving the pointers
- delete pItem;
- }
- else
- ++i;
- }
- */
mpWrtShell->EndUndo( UNDO_DELETE );
PrepareView();
mpWrtShell->EndAllAction();
@@ -1249,14 +1262,14 @@ void SwPostItMgr::Delete(String aAuthor)
void SwPostItMgr::Delete()
{
mpWrtShell->StartAllAction();
- SetActivePostIt(0);
+ SetActiveSidebarWin(0);
SwRewriter aRewriter;
aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_DELETE_ALL_NOTES) );
mpWrtShell->StartUndo( UNDO_DELETE, &aRewriter );
std::vector<SwFmtFld*> aTmp;
aTmp.reserve( mvPostItFlds.size() );
- for(std::list<SwMarginItem*>::iterator pPostIt = mvPostItFlds.begin(); pPostIt!= mvPostItFlds.end() ; pPostIt++)
+ for(std::list<SwSidebarItem*>::iterator pPostIt = mvPostItFlds.begin(); pPostIt!= mvPostItFlds.end() ; pPostIt++)
{
if ((*pPostIt)->GetFmtFld())
aTmp.push_back( (*pPostIt)->GetFmtFld() );
@@ -1294,7 +1307,7 @@ void SwPostItMgr::Delete()
void SwPostItMgr::Hide(SwPostItField* pPostItField )
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ((*i)->GetFmtFld())
{
@@ -1313,7 +1326,7 @@ void SwPostItMgr::Hide(SwPostItField* pPostItField )
void SwPostItMgr::Hide( const String& rAuthor )
{
- for(SwMarginItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ( (*i)->pPostIt && ((*i)->pPostIt->GetAuthor() == rAuthor) )
{
@@ -1327,7 +1340,7 @@ void SwPostItMgr::Hide( const String& rAuthor )
void SwPostItMgr::Hide()
{
- for(SwMarginItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
(*i)->bShow = false;
(*i)->pPostIt->HideNote();
@@ -1337,7 +1350,7 @@ void SwPostItMgr::Hide()
void SwPostItMgr::Show()
{
- for(SwMarginItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
(*i)->bShow = true;
}
@@ -1365,7 +1378,7 @@ void SwPostItMgr::Sort(const short aType)
}
}
-SwMarginWin* SwPostItMgr::GetPostIt(SfxBroadcaster* pBroadcaster) const
+SwSidebarWin* SwPostItMgr::GetSidebarWin( const SfxBroadcaster* pBroadcaster) const
{
for(const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
@@ -1375,32 +1388,12 @@ SwMarginWin* SwPostItMgr::GetPostIt(SfxBroadcaster* pBroadcaster) const
return NULL;
}
-SwPostIt* SwPostItMgr::GetPostIt(SwPostItField* pFld) const
-{
- for(const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
- {
- if ( (*i)->GetFmtFld() && ((*i)->GetFmtFld()->GetFld() == pFld) )
- return static_cast<SwPostIt*>((*i)->pPostIt);
- }
- return NULL;
-}
-
-SwMarginWin* SwPostItMgr::GetPostIt( const SfxBroadcaster* pBroadcaster) const
-{
- for(const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
- {
- if ( (*i)->GetBroadCaster() == pBroadcaster)
- return (*i)->pPostIt;
- }
- return NULL;
-}
-
-SwPostIt* SwPostItMgr::GetPostIt(const SwPostItField* pFld) const
+sw::annotation::SwAnnotationWin* SwPostItMgr::GetAnnotationWin(const SwPostItField* pFld) const
{
for(const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ( (*i)->GetFmtFld() && ((*i)->GetFmtFld()->GetFld() == pFld))
- return static_cast<SwPostIt*>((*i)->pPostIt);
+ return dynamic_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt);
}
return NULL;
}
@@ -1429,15 +1422,16 @@ bool SwPostItMgr::ShowPreview(const SwField* pFld, SwFmtFld*& pFmtFld) const
return false;
}
-SwMarginWin* SwPostItMgr::GetNextPostIt(USHORT aDirection, SwMarginWin* aPostIt)
+SwSidebarWin* SwPostItMgr::GetNextPostIt( USHORT aDirection,
+ SwSidebarWin* aPostIt )
{
if (mvPostItFlds.size()>1)
{
- for(SwMarginItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
if ( (*i)->pPostIt ==aPostIt)
{
- SwMarginItem_iterator iNextPostIt = i;
+ SwSidebarItem_iterator iNextPostIt = i;
if (aDirection==KEY_PAGEUP)
{
if ( iNextPostIt==mvPostItFlds.begin() )
@@ -1470,11 +1464,11 @@ long SwPostItMgr::GetNextBorder()
{
for (unsigned long n=0;n<mPages.size();n++)
{
- for(SwMarginItem_iterator b = mPages[n]->mList->begin(); b!= mPages[n]->mList->end(); b++)
+ for(SwSidebarItem_iterator b = mPages[n]->mList->begin(); b!= mPages[n]->mList->end(); b++)
{
if ((*b)->pPostIt == mpActivePostIt)
{
- SwMarginItem_iterator aNext = b;
+ SwSidebarItem_iterator aNext = b;
aNext++;
bool bFollow = (aNext == mPages[n]->mList->end()) ? false : (*aNext)->pPostIt->IsFollow();
if ( mPages[n]->bScrollbar || bFollow )
@@ -1507,15 +1501,16 @@ void SwPostItMgr::SetShadowState(const SwPostItField* pFld,bool bCursor)
{
// reset old one if still alive
// TODO: does not work properly if mouse and cursor was set
- SwPostIt* pOldPostIt = GetPostIt(mShadowState.mpShadowFld);
+ sw::annotation::SwAnnotationWin* pOldPostIt =
+ GetAnnotationWin(mShadowState.mpShadowFld);
if (pOldPostIt && pOldPostIt->Shadow() && (pOldPostIt->Shadow()->GetShadowState() != SS_EDIT))
- pOldPostIt->SetViewState(SS_NORMAL);
+ pOldPostIt->SetViewState(VS_NORMAL);
}
//set new one, if it is not currently edited
- SwPostIt* pNewPostIt = GetPostIt(pFld);
+ sw::annotation::SwAnnotationWin* pNewPostIt = GetAnnotationWin(pFld);
if (pNewPostIt && pNewPostIt->Shadow() && (pNewPostIt->Shadow()->GetShadowState() != SS_EDIT))
{
- pNewPostIt->SetViewState(SS_VIEW);
+ pNewPostIt->SetViewState(VS_VIEW);
//remember our new field
mShadowState.mpShadowFld = pFld;
mShadowState.bCursor = false;
@@ -1538,10 +1533,10 @@ void SwPostItMgr::SetShadowState(const SwPostItField* pFld,bool bCursor)
if (!mShadowState.bCursor && !mShadowState.bMouse)
{
// reset old one if still alive
- SwPostIt* pOldPostIt = GetPostIt(mShadowState.mpShadowFld);
+ sw::annotation::SwAnnotationWin* pOldPostIt = GetAnnotationWin(mShadowState.mpShadowFld);
if (pOldPostIt && pOldPostIt->Shadow() && (pOldPostIt->Shadow()->GetShadowState() != SS_EDIT))
{
- pOldPostIt->SetViewState(SS_NORMAL);
+ pOldPostIt->SetViewState(VS_NORMAL);
mShadowState.mpShadowFld = 0;
}
}
@@ -1583,8 +1578,9 @@ bool SwPostItMgr::IsHit(const Point &aPointPixel)
{
Rectangle aRect;
DBG_ASSERT(mPages.size()>nPageNum-1,"SwPostitMgr:: page container size wrong");
- aRect = mPages[nPageNum-1]->bMarginSide ? Rectangle(Point(aPageFrm.Left()-GetSidebarWidth()-GetSidebarBorderWidth(),aPageFrm.Top()),Size(GetSidebarWidth(),aPageFrm.Height())) :
- Rectangle( Point(aPageFrm.Right()+GetSidebarBorderWidth(),aPageFrm.Top()) , Size(GetSidebarWidth(),aPageFrm.Height()));
+ aRect = mPages[nPageNum-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Rectangle(Point(aPageFrm.Left()-GetSidebarWidth()-GetSidebarBorderWidth(),aPageFrm.Top()),Size(GetSidebarWidth(),aPageFrm.Height()))
+ : Rectangle( Point(aPageFrm.Right()+GetSidebarBorderWidth(),aPageFrm.Top()) , Size(GetSidebarWidth(),aPageFrm.Height()));
if (aRect.IsInside(aPoint))
{
// we hit the note's sidebar
@@ -1601,8 +1597,9 @@ bool SwPostItMgr::IsHit(const Point &aPointPixel)
Rectangle SwPostItMgr::GetBottomScrollRect(const unsigned long aPage) const
{
SwRect aPageRect = mPages[aPage-1]->mPageRect;
- Point aPointBottom = mPages[aPage-1]->bMarginSide ? Point(aPageRect.Left() - GetSidebarWidth() - GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height()) :
- Point(aPageRect.Right() + GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height());
+ Point aPointBottom = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Point(aPageRect.Left() - GetSidebarWidth() - GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height())
+ : Point(aPageRect.Right() + GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height());
Size aSize(GetSidebarWidth() - mpEditWin->PixelToLogic(Size(4,0)).Width(), mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height()) ;
return Rectangle(aPointBottom,aSize);
@@ -1611,8 +1608,9 @@ Rectangle SwPostItMgr::GetBottomScrollRect(const unsigned long aPage) const
Rectangle SwPostItMgr::GetTopScrollRect(const unsigned long aPage) const
{
SwRect aPageRect = mPages[aPage-1]->mPageRect;
- Point aPointTop = mPages[aPage-1]->bMarginSide ? Point(aPageRect.Left() - GetSidebarWidth() -GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height()) :
- Point(aPageRect.Right() + GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height());
+ Point aPointTop = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Point(aPageRect.Left() - GetSidebarWidth() -GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height())
+ : Point(aPageRect.Right() + GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height());
Size aSize(GetSidebarWidth() - mpEditWin->PixelToLogic(Size(4,0)).Width(), mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height()) ;
return Rectangle(aPointTop,aSize);
}
@@ -1622,11 +1620,13 @@ Rectangle SwPostItMgr::GetTopScrollRect(const unsigned long aPage) const
bool SwPostItMgr::ScrollbarHit(const unsigned long aPage,const Point &aPoint)
{
SwRect aPageRect = mPages[aPage-1]->mPageRect;
- Point aPointBottom = mPages[aPage-1]->bMarginSide ? Point(aPageRect.Left() - GetSidebarWidth()-GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height()) :
- Point(aPageRect.Right() + GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height());
+ Point aPointBottom = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Point(aPageRect.Left() - GetSidebarWidth()-GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height())
+ : Point(aPageRect.Right() + GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height());
- Point aPointTop = mPages[aPage-1]->bMarginSide ? Point(aPageRect.Left() - GetSidebarWidth()-GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height()) :
- Point(aPageRect.Right()+GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height());
+ Point aPointTop = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Point(aPageRect.Left() - GetSidebarWidth()-GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height())
+ : Point(aPageRect.Right()+GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height());
Rectangle aRectBottom(GetBottomScrollRect(aPage));
Rectangle aRectTop(GetTopScrollRect(aPage));
@@ -1657,8 +1657,8 @@ void SwPostItMgr::CorrectPositions()
return;
// find first valid note
- SwMarginWin *pFirstPostIt = 0;
- for(SwMarginItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ SwSidebarWin *pFirstPostIt = 0;
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
{
pFirstPostIt = (*i)->pPostIt;
if (pFirstPostIt)
@@ -1670,23 +1670,23 @@ void SwPostItMgr::CorrectPositions()
return;
// yeah, I know, if this is a left page it could be wrong, but finding the page and the note is probably not even faster than just doing it
- const long aAnkorX = mpEditWin->LogicToPixel( Point((long)(pFirstPostIt->Ankor()->GetSixthPosition().getX()),0)).X();
- const long aAnkorY = mpEditWin->LogicToPixel( Point(0,(long)(pFirstPostIt->Ankor()->GetSixthPosition().getY()))).Y() + 1;
- if (Point(aAnkorX,aAnkorY) != pFirstPostIt->GetPosPixel())
+ const long aAnchorX = mpEditWin->LogicToPixel( Point((long)(pFirstPostIt->Anchor()->GetSixthPosition().getX()),0)).X();
+ const long aAnchorY = mpEditWin->LogicToPixel( Point(0,(long)(pFirstPostIt->Anchor()->GetSixthPosition().getY()))).Y() + 1;
+ if (Point(aAnchorX,aAnchorY) != pFirstPostIt->GetPosPixel())
{
- long aAnkorPosX = 0;
- long aAnkorPosY = 0;
+ long aAnchorPosX = 0;
+ long aAnchorPosY = 0;
for (unsigned long n=0;n<mPages.size();n++)
{
- for(SwMarginItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
+ for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
{
if ((*i)->bShow && (*i)->pPostIt)
{
- aAnkorPosX = mPages[n]->bMarginSide ?
- mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Ankor()->GetSeventhPosition().getX()),0)).X() :
- mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Ankor()->GetSixthPosition().getX()),0)).X();
- aAnkorPosY = mpEditWin->LogicToPixel( Point(0,(long)((*i)->pPostIt->Ankor()->GetSixthPosition().getY()))).Y() + 1;
- (*i)->pPostIt->SetPosPixel(Point(aAnkorPosX,aAnkorPosY));
+ aAnchorPosX = mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSeventhPosition().getX()),0)).X()
+ : mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSixthPosition().getX()),0)).X();
+ aAnchorPosY = mpEditWin->LogicToPixel( Point(0,(long)((*i)->pPostIt->Anchor()->GetSixthPosition().getY()))).Y() + 1;
+ (*i)->pPostIt->SetPosPixel(Point(aAnchorPosX,aAnchorPosY));
}
}
}
@@ -1757,29 +1757,29 @@ Color SwPostItMgr::GetColorLight(sal_uInt16 aAuthorIndex)
return Color(COL_WHITE);
}
-Color SwPostItMgr::GetColorAnkor(sal_uInt16 aAuthorIndex)
+Color SwPostItMgr::GetColorAnchor(sal_uInt16 aAuthorIndex)
{
if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode())
{
- static const Color aArrayAnkor[] = {
+ static const Color aArrayAnchor[] = {
COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK,
COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK,
COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK };
- return Color( aArrayAnkor[ aAuthorIndex % (sizeof( aArrayAnkor ) / sizeof( aArrayAnkor[0] ))]);
+ return Color( aArrayAnchor[ aAuthorIndex % (sizeof( aArrayAnchor ) / sizeof( aArrayAnchor[0] ))]);
}
else
return Color(COL_WHITE);
}
-void SwPostItMgr::SetActivePostIt( SwMarginWin* p)
+void SwPostItMgr::SetActiveSidebarWin( SwSidebarWin* p)
{
if ( p != mpActivePostIt )
{
// we need the temp variable so we can set mpActivePostIt before we call DeactivatePostIt
// therefore we get a new layout in DOCCHANGED when switching from postit to document,
// otherwise, GetActivePostIt() would still hold our old postit
- SwMarginWin* pActive = mpActivePostIt;
+ SwSidebarWin* pActive = mpActivePostIt;
mpActivePostIt = p;
if (pActive)
{
@@ -1816,7 +1816,7 @@ IMPL_LINK( SwPostItMgr, CalcHdl, void*, /* pVoid*/ )
void SwPostItMgr::Rescale()
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
if ( (*i)->pPostIt )
(*i)->pPostIt->Rescale();
}
@@ -1824,7 +1824,7 @@ void SwPostItMgr::Rescale()
sal_Int32 SwPostItMgr::GetInitialAnchorDistance() const
{
const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
- return POSTIT_INITIAL_ANKOR_DISTANCE * f.GetNumerator() / f.GetDenominator();
+ return POSTIT_INITIAL_ANCHOR_DISTANCE * f.GetNumerator() / f.GetDenominator();
}
sal_Int32 SwPostItMgr::GetSpaceBetween() const
@@ -1853,21 +1853,21 @@ sal_Int32 SwPostItMgr::GetSidebarScrollerHeight() const
void SwPostItMgr::SetSpellChecking()
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
if ( (*i)->pPostIt )
(*i)->pPostIt->SetSpellChecking();
}
void SwPostItMgr::SetReadOnlyState()
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
if ( (*i)->pPostIt )
(*i)->pPostIt->SetReadonly( mbReadOnly );
}
void SwPostItMgr::CheckMetaText()
{
- for(std::list<SwMarginItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
if ( (*i)->pPostIt )
(*i)->pPostIt->CheckMetaText();
@@ -1875,45 +1875,45 @@ void SwPostItMgr::CheckMetaText()
sal_uInt16 SwPostItMgr::Replace(SvxSearchItem* pItem)
{
- SwMarginWin* pWin = GetActivePostIt();
- sal_uInt16 aResult = pWin->View()->StartSearchAndReplace( *pItem );
+ SwSidebarWin* pWin = GetActiveSidebarWin();
+ sal_uInt16 aResult = pWin->GetOutlinerView()->StartSearchAndReplace( *pItem );
if (!aResult)
- SetActivePostIt(0);
+ SetActiveSidebarWin(0);
return aResult;
}
sal_uInt16 SwPostItMgr::FinishSearchReplace(const ::com::sun::star::util::SearchOptions& rSearchOptions, bool bSrchForward)
{
- SwMarginWin* pWin = GetActivePostIt();
+ SwSidebarWin* pWin = GetActiveSidebarWin();
SvxSearchItem aItem(SID_SEARCH_ITEM );
aItem.SetSearchOptions(rSearchOptions);
aItem.SetBackward(!bSrchForward);
- sal_uInt16 aResult = pWin->View()->StartSearchAndReplace( aItem );
+ sal_uInt16 aResult = pWin->GetOutlinerView()->StartSearchAndReplace( aItem );
if (!aResult)
- SetActivePostIt(0);
+ SetActiveSidebarWin(0);
return aResult;
}
sal_uInt16 SwPostItMgr::SearchReplace(const SwFmtFld &pFld, const ::com::sun::star::util::SearchOptions& rSearchOptions, bool bSrchForward)
{
sal_uInt16 aResult = 0;
- SwMarginWin* pWin = GetPostIt(&pFld);
+ SwSidebarWin* pWin = GetSidebarWin(&pFld);
if (pWin)
{
- ESelection aOldSelection = pWin->View()->GetSelection();
+ ESelection aOldSelection = pWin->GetOutlinerView()->GetSelection();
if (bSrchForward)
- pWin->View()->SetSelection(ESelection(0,0,0,0));
+ pWin->GetOutlinerView()->SetSelection(ESelection(0,0,0,0));
else
- pWin->View()->SetSelection(ESelection(0xFFFF,0xFFFF,0xFFFF,0xFFFF));
+ pWin->GetOutlinerView()->SetSelection(ESelection(0xFFFF,0xFFFF,0xFFFF,0xFFFF));
SvxSearchItem aItem(SID_SEARCH_ITEM );
aItem.SetSearchOptions(rSearchOptions);
aItem.SetBackward(!bSrchForward);
- aResult = pWin->View()->StartSearchAndReplace( aItem );
+ aResult = pWin->GetOutlinerView()->StartSearchAndReplace( aItem );
if (!aResult)
- pWin->View()->SetSelection(aOldSelection);
+ pWin->GetOutlinerView()->SetSelection(aOldSelection);
else
{
- SetActivePostIt(pWin);
+ SetActiveSidebarWin(pWin);
MakeVisible(pWin);
}
}
@@ -1945,6 +1945,121 @@ void SwPostItMgr::AssureStdModeAtShell()
}
}
+bool SwPostItMgr::HasActiveSidebarWin() const
+{
+ return mpActivePostIt != 0;
+}
+
+bool SwPostItMgr::HasActiveAnnotationWin() const
+{
+ return HasActiveSidebarWin() &&
+ dynamic_cast<sw::annotation::SwAnnotationWin*>(mpActivePostIt) != 0;
+}
+
+void SwPostItMgr::GrabFocusOnActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->GrabFocus();
+ }
+}
+
+void SwPostItMgr::UpdateDataOnActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->UpdateData();
+ }
+}
+
+void SwPostItMgr::DeleteActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->Delete();
+ }
+}
+
+void SwPostItMgr::HideActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->Hide();
+ }
+}
+
+void SwPostItMgr::ToggleInsModeOnActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->ToggleInsMode();
+ }
+}
+
+void SwPostItMgr::ConnectSidebarWinToFrm( const SwFrm& rFrm,
+ const SwFmtFld& rFmtFld,
+ SwSidebarWin& rSidebarWin )
+{
+ if ( mpFrmSidebarWinContainer == 0 )
+ {
+ mpFrmSidebarWinContainer = new SwFrmSidebarWinContainer();
+ }
+
+ const bool bInserted = mpFrmSidebarWinContainer->insert( rFrm, rFmtFld, rSidebarWin );
+ if ( bInserted &&
+ mpWrtShell->GetAccessibleMap() )
+ {
+ mpWrtShell->GetAccessibleMap()->InvalidatePosOrSize( 0, 0, &rSidebarWin, SwRect() );
+ }
+}
+
+void SwPostItMgr::DisconnectSidebarWinFromFrm( const SwFrm& rFrm,
+ SwSidebarWin& rSidebarWin )
+{
+ if ( mpFrmSidebarWinContainer != 0 )
+ {
+ const bool bRemoved = mpFrmSidebarWinContainer->remove( rFrm, rSidebarWin );
+ if ( bRemoved &&
+ mpWrtShell->GetAccessibleMap() )
+ {
+ mpWrtShell->GetAccessibleMap()->Dispose( 0, 0, &rSidebarWin );
+ }
+ }
+}
+
+bool SwPostItMgr::HasFrmConnectedSidebarWins( const SwFrm& rFrm )
+{
+ bool bRet( false );
+
+ if ( mpFrmSidebarWinContainer != 0 )
+ {
+ bRet = !mpFrmSidebarWinContainer->empty( rFrm );
+ }
+
+ return bRet;
+}
+
+Window* SwPostItMgr::GetSidebarWinForFrmByIndex( const SwFrm& rFrm,
+ const sal_Int32 nIndex )
+{
+ Window* pSidebarWin( 0 );
+
+ if ( mpFrmSidebarWinContainer != 0 )
+ {
+ pSidebarWin = mpFrmSidebarWinContainer->get( rFrm, nIndex );
+ }
+
+ return pSidebarWin;
+}
+
+void SwPostItMgr::GetAllSidebarWinForFrm( const SwFrm& rFrm,
+ std::vector< Window* >* pChildren )
+{
+ if ( mpFrmSidebarWinContainer != 0 )
+ {
+ mpFrmSidebarWinContainer->getAll( rFrm, pChildren );
+ }
+}
+
void SwNoteProps::Commit() {}
void SwNoteProps::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
-
diff --git a/sw/source/ui/docvw/ShadowOverlayObject.cxx b/sw/source/ui/docvw/ShadowOverlayObject.cxx
new file mode 100644
index 000000000000..b11fc914b5fd
--- /dev/null
+++ b/sw/source/ui/docvw/ShadowOverlayObject.cxx
@@ -0,0 +1,268 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: postit.cxx,v $
+ * $Revision: 1.8.42.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <ShadowOverlayObject.hxx>
+
+#include <view.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/svdview.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+
+#include <sw_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
+
+namespace sw { namespace sidebarwindows {
+
+//////////////////////////////////////////////////////////////////////////////
+// helper SwPostItShadowPrimitive
+//
+// Used to allow view-dependent primitive definition. For that purpose, the
+// initially created primitive (this one) always has to be view-independent,
+// but the decomposition is made view-dependent. Very simple primitive which
+// just remembers the discrete data and applies it at decomposition time.
+
+class ShadowPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D
+{
+private:
+ basegfx::B2DPoint maBasePosition;
+ basegfx::B2DPoint maSecondPosition;
+ ShadowState maShadowState;
+
+protected:
+ virtual drawinglayer::primitive2d::Primitive2DSequence create2DDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation) const;
+
+public:
+ ShadowPrimitive(
+ const basegfx::B2DPoint& rBasePosition,
+ const basegfx::B2DPoint& rSecondPosition,
+ ShadowState aShadowState)
+ : drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D(),
+ maBasePosition(rBasePosition),
+ maSecondPosition(rSecondPosition),
+ maShadowState(aShadowState)
+ {}
+
+ // data access
+ const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
+ const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; }
+ ShadowState getShadowState() const { return maShadowState; }
+
+ virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const;
+
+ DeclPrimitrive2DIDBlock()
+};
+
+drawinglayer::primitive2d::Primitive2DSequence ShadowPrimitive::create2DDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const
+{
+ // get logic sizes in object coordinate system
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ basegfx::B2DRange aRange(getBasePosition());
+
+ switch(maShadowState)
+ {
+ case SS_NORMAL:
+ {
+ aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (2.0 * getDiscreteUnit())));
+ const ::drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
+ drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
+ 0.0,
+ 0.5,
+ 0.5,
+ 1800.0 * F_PI1800,
+ basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
+ basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
+ 2);
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ aRange,
+ aFillGradientAttribute));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ break;
+ }
+ case SS_VIEW:
+ {
+ aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit())));
+ const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
+ drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
+ 0.0,
+ 0.5,
+ 0.5,
+ 1800.0 * F_PI1800,
+ basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
+ basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
+ 4);
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ aRange,
+ aFillGradientAttribute));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ break;
+ }
+ case SS_EDIT:
+ {
+ aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit())));
+ const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
+ drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
+ 0.0,
+ 0.5,
+ 0.5,
+ 1800.0 * F_PI1800,
+ basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
+ basegfx::BColor(83.0/255.0,83.0/255.0,83.0/255.0),
+ 4);
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ aRange,
+ aFillGradientAttribute));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ return xRetval;
+}
+
+bool ShadowPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const
+{
+ if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const ShadowPrimitive& rCompare = static_cast< const ShadowPrimitive& >(rPrimitive);
+
+ return (getBasePosition() == rCompare.getBasePosition()
+ && getSecondPosition() == rCompare.getSecondPosition()
+ && getShadowState() == rCompare.getShadowState());
+ }
+
+ return false;
+}
+
+ImplPrimitrive2DIDBlock(ShadowPrimitive, PRIMITIVE2D_ID_SWSIDEBARSHADOWPRIMITIVE)
+
+/****** ShadowOverlayObject **************************************************/
+/* static */ ShadowOverlayObject* ShadowOverlayObject::CreateShadowOverlayObject( SwView& rDocView )
+{
+ ShadowOverlayObject* pShadowOverlayObject( 0 );
+
+ if ( rDocView.GetDrawView() )
+ {
+ SdrPaintWindow* pPaintWindow = rDocView.GetDrawView()->GetPaintWindow(0);
+ if( pPaintWindow )
+ {
+ sdr::overlay::OverlayManager* pOverlayManager = pPaintWindow->GetOverlayManager();
+
+ if ( pOverlayManager )
+ {
+ pShadowOverlayObject = new ShadowOverlayObject( basegfx::B2DPoint(0,0),
+ basegfx::B2DPoint(0,0),
+ Color(0,0,0),
+ SS_NORMAL );
+ pOverlayManager->add(*pShadowOverlayObject);
+ }
+ }
+ }
+
+ return pShadowOverlayObject;
+}
+
+/* static */ void ShadowOverlayObject::DestroyShadowOverlayObject( ShadowOverlayObject* pShadow )
+{
+ if ( pShadow )
+ {
+ if ( pShadow->getOverlayManager() )
+ {
+ pShadow->getOverlayManager()->remove(*pShadow);
+ }
+ delete pShadow;
+ }
+}
+
+ShadowOverlayObject::ShadowOverlayObject( const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPosition,
+ Color aBaseColor,
+ ShadowState aState )
+ : OverlayObjectWithBasePosition(rBasePos, aBaseColor)
+ , maSecondPosition(rSecondPosition)
+ , mShadowState(aState)
+{
+}
+
+ShadowOverlayObject::~ShadowOverlayObject()
+{
+}
+
+drawinglayer::primitive2d::Primitive2DSequence ShadowOverlayObject::createOverlayObjectPrimitive2DSequence()
+{
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new ShadowPrimitive( getBasePosition(),
+ GetSecondPosition(),
+ GetShadowState() ) );
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+}
+
+void ShadowOverlayObject::SetShadowState(ShadowState aState)
+{
+ if (mShadowState != aState)
+ {
+ mShadowState = aState;
+
+ objectChange();
+ }
+}
+
+void ShadowOverlayObject::SetPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2)
+{
+ if(!rPoint1.equal(getBasePosition()) || !rPoint2.equal(GetSecondPosition()))
+ {
+ maBasePosition = rPoint1;
+ maSecondPosition = rPoint2;
+
+ objectChange();
+ }
+}
+
+} } // end of namespace sw::sidebarwindows
+
diff --git a/sw/source/ui/docvw/ShadowOverlayObject.hxx b/sw/source/ui/docvw/ShadowOverlayObject.hxx
new file mode 100644
index 000000000000..a00aea380fdb
--- /dev/null
+++ b/sw/source/ui/docvw/ShadowOverlayObject.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SHADOWOVERLAYOBJECT_HXX
+#define _SHADOWOVERLAYOBJECT_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+
+class SwView;
+
+namespace sw { namespace sidebarwindows {
+
+enum ShadowState
+{
+ SS_NORMAL,
+ SS_VIEW,
+ SS_EDIT
+};
+
+class ShadowOverlayObject: public sdr::overlay::OverlayObjectWithBasePosition
+{
+ protected:
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ private:
+ basegfx::B2DPoint maSecondPosition;
+ ShadowState mShadowState;
+
+ ShadowOverlayObject( const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPosition,
+ Color aBaseColor,
+ ShadowState aState );
+ virtual ~ShadowOverlayObject();
+
+ public:
+ void SetShadowState(ShadowState aState);
+ inline ShadowState GetShadowState() {return mShadowState;}
+
+ inline const basegfx::B2DPoint& GetSecondPosition() const { return maSecondPosition; }
+ void SetSecondPosition( const basegfx::B2DPoint& rNew );
+
+ void SetPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2 );
+
+ static ShadowOverlayObject* CreateShadowOverlayObject( SwView& rDocView );
+ static void DestroyShadowOverlayObject( ShadowOverlayObject* pShadow );
+};
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/docvw/SidebarTxtControl.cxx b/sw/source/ui/docvw/SidebarTxtControl.cxx
new file mode 100644
index 000000000000..61d4884157cf
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarTxtControl.cxx
@@ -0,0 +1,422 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <SidebarTxtControl.hxx>
+
+#include <SidebarTxtControlAcc.hxx>
+
+#include <SidebarWin.hxx>
+#include <PostItMgr.hxx>
+
+#include <cmdid.h>
+#include <docvw.hrc>
+
+#include <unotools/securityoptions.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/mnumgr.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/help.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/scrbar.hxx>
+
+#include <editeng/outliner.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editview.hxx>
+#include <editeng/flditem.hxx>
+
+#include <uitool.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <shellres.hxx>
+#include <SwRewriter.hxx>
+#include <undobj.hxx>
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace sidebarwindows {
+
+SidebarTxtControl::SidebarTxtControl( SwSidebarWin& rSidebarWin,
+ WinBits nBits,
+ SwView& rDocView,
+ SwPostItMgr& rPostItMgr )
+ : Control( &rSidebarWin, nBits )
+ , mrSidebarWin( rSidebarWin )
+ , mrDocView( rDocView )
+ , mrPostItMgr( rPostItMgr )
+ , mbMouseOver( false )
+{
+ AddEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) );
+}
+
+SidebarTxtControl::~SidebarTxtControl()
+{
+ RemoveEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) );
+}
+
+OutlinerView* SidebarTxtControl::GetTextView() const
+{
+ return mrSidebarWin.GetOutlinerView();
+}
+
+void SidebarTxtControl::GetFocus()
+{
+ Window::GetFocus();
+ if ( !mrSidebarWin.IsMouseOver() )
+ {
+ Invalidate();
+ }
+}
+
+void SidebarTxtControl::LoseFocus()
+{
+ // write the visible text back into the SwField
+ mrSidebarWin.UpdateData();
+
+ Window::LoseFocus();
+ if ( !mrSidebarWin.IsMouseOver() )
+ {
+ Invalidate();
+ }
+}
+
+void SidebarTxtControl::RequestHelp(const HelpEvent &rEvt)
+{
+ USHORT nResId = 0;
+ switch( mrSidebarWin.GetLayoutStatus() )
+ {
+ case SwPostItHelper::INSERTED: nResId = STR_REDLINE_INSERT; break;
+ case SwPostItHelper::DELETED: nResId = STR_REDLINE_DELETE; break;
+ default: nResId = 0;
+ }
+
+ SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE );
+ if ( nResId &&
+ mrDocView.GetWrtShell().GetContentAtPos( mrSidebarWin.GetAnchorPos(), aCntntAtPos ) )
+ {
+ String sTxt;
+ sTxt = SW_RESSTR( nResId );
+ sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM(": " ));
+ sTxt += aCntntAtPos.aFnd.pRedl->GetAuthorString();
+ sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " ));
+ sTxt += GetAppLangDateTimeString( aCntntAtPos.aFnd.pRedl->GetTimeStamp() );
+ Help::ShowQuickHelp( this,PixelToLogic(Rectangle(rEvt.GetMousePosPixel(),Size(50,10))),sTxt);
+ }
+}
+
+void SidebarTxtControl::Paint( const Rectangle& rRect)
+{
+ if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ if ( mrSidebarWin.IsMouseOverSidebarWin() ||
+ HasFocus() )
+ {
+ DrawGradient( Rectangle( Point(0,0), PixelToLogic(GetSizePixel()) ),
+ Gradient( GRADIENT_LINEAR,
+ mrSidebarWin.ColorDark(),
+ mrSidebarWin.ColorDark() ) );
+ }
+ else
+ {
+ DrawGradient( Rectangle( Point(0,0), PixelToLogic(GetSizePixel()) ),
+ Gradient( GRADIENT_LINEAR,
+ mrSidebarWin.ColorLight(),
+ mrSidebarWin.ColorDark()));
+ }
+ }
+
+ if ( GetTextView() )
+ {
+ GetTextView()->Paint( rRect );
+ }
+
+ if ( mrSidebarWin.GetLayoutStatus()==SwPostItHelper::DELETED )
+ {
+ SetLineColor(mrSidebarWin.GetChangeColor());
+ DrawLine( PixelToLogic( GetPosPixel() ),
+ PixelToLogic( GetPosPixel() +
+ Point( GetSizePixel().Width(),
+ GetSizePixel().Height() ) ) );
+ DrawLine( PixelToLogic( GetPosPixel() +
+ Point( GetSizePixel().Width(),0) ),
+ PixelToLogic( GetPosPixel() +
+ Point( 0, GetSizePixel().Height() ) ) );
+ }
+}
+
+void SidebarTxtControl::KeyInput( const KeyEvent& rKeyEvt )
+{
+ const KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
+ USHORT nKey = rKeyCode.GetCode();
+ if ( ( rKeyCode.IsMod1() && rKeyCode.IsMod2() ) &&
+ ( (nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN) ) )
+ {
+ mrSidebarWin.SwitchToPostIt(nKey);
+ }
+ else if ( nKey == KEY_ESCAPE ||
+ ( rKeyCode.IsMod1() &&
+ ( nKey == KEY_PAGEUP ||
+ nKey == KEY_PAGEDOWN ) ) )
+ {
+ mrSidebarWin.SwitchToFieldPos();
+ }
+ else if ( nKey == KEY_INSERT )
+ {
+ if ( !rKeyCode.IsMod1() && !rKeyCode.IsMod2() )
+ {
+ mrSidebarWin.ToggleInsMode();
+ }
+ }
+ else
+ {
+ //let's make sure we see our note
+ mrPostItMgr.MakeVisible(&mrSidebarWin);
+
+ long aOldHeight = mrSidebarWin.GetPostItTextHeight();
+ bool bDone = false;
+
+ /// HACK: need to switch off processing of Undo/Redo in Outliner
+ if ( !( (nKey == KEY_Z || nKey == KEY_Y) && rKeyCode.IsMod1()) )
+ {
+ bool bIsProtected = mrSidebarWin.IsProtected();
+ if ( !bIsProtected ||
+ ( bIsProtected &&
+ !mrSidebarWin.GetOutlinerView()->GetOutliner()->GetEditEngine().DoesKeyChangeText(rKeyEvt)) )
+ {
+ bDone = GetTextView() && GetTextView()->PostKeyEvent( rKeyEvt );
+ }
+ else
+ {
+ InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute();
+ }
+ }
+ if (bDone)
+ mrSidebarWin.ResizeIfNeccessary( aOldHeight, mrSidebarWin.GetPostItTextHeight() );
+ else
+ {
+ // write back data first when showing navigator
+ if ( nKey==KEY_F5 )
+ mrSidebarWin.UpdateData();
+ if (!mrDocView.KeyInput(rKeyEvt))
+ Window::KeyInput(rKeyEvt);
+ }
+ }
+
+ mrDocView.GetViewFrame()->GetBindings().InvalidateAll(FALSE);
+}
+
+void SidebarTxtControl::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( GetTextView() )
+ {
+ OutlinerView* pOutlinerView( GetTextView() );
+ pOutlinerView->MouseMove( rMEvt );
+ // mba: why does OutlinerView not handle the modifier setting?!
+ // this forces the postit to handle *all* pointer types
+ SetPointer( pOutlinerView->GetPointer( rMEvt.GetPosPixel() ) );
+
+ const EditView& aEV = pOutlinerView->GetEditView();
+ const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer();
+ if ( pItem )
+ {
+ const SvxFieldData* pFld = pItem->GetField();
+ const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld );
+ if ( pURL )
+ {
+ String sURL( pURL->GetURL() );
+ SvtSecurityOptions aSecOpts;
+ if ( aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK) )
+ {
+ sURL.InsertAscii( ": ", 0 );
+ sURL.Insert( ViewShell::GetShellRes()->aHyperlinkClick, 0 );
+ }
+ Help::ShowQuickHelp( this,PixelToLogic(Rectangle(GetPosPixel(),Size(50,10))),sURL);
+ }
+ }
+ }
+}
+
+void SidebarTxtControl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( GetTextView() )
+ {
+ SvtSecurityOptions aSecOpts;
+ bool bExecuteMod = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK);
+
+ if ( !bExecuteMod || (bExecuteMod && rMEvt.GetModifier() == KEY_MOD1))
+ {
+ const EditView& aEV = GetTextView()->GetEditView();
+ const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer();
+ if ( pItem )
+ {
+ const SvxFieldData* pFld = pItem->GetField();
+ const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld );
+ if ( pURL )
+ {
+ GetTextView()->MouseButtonDown( rMEvt );
+ SwWrtShell &rSh = mrDocView.GetWrtShell();
+ String sURL( pURL->GetURL() );
+ String sTarget( pURL->GetTargetFrame() );
+ ::LoadURL( sURL, &rSh, URLLOAD_NOFILTER, &sTarget);
+ return;
+ }
+ }
+ }
+ }
+
+ GrabFocus();
+ if ( GetTextView() )
+ {
+ GetTextView()->MouseButtonDown( rMEvt );
+ }
+ mrDocView.GetViewFrame()->GetBindings().InvalidateAll(FALSE);
+}
+
+void SidebarTxtControl::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if ( GetTextView() )
+ GetTextView()->MouseButtonUp( rMEvt );
+}
+
+IMPL_LINK( SidebarTxtControl, OnlineSpellCallback, SpellCallbackInfo*, pInfo )
+{
+ if ( pInfo->nCommand == SPELLCMD_STARTSPELLDLG )
+ {
+ mrDocView.GetViewFrame()->GetDispatcher()->Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON);
+ }
+ return 0;
+}
+
+IMPL_LINK( SidebarTxtControl, Select, Menu*, pSelMenu )
+{
+ mrSidebarWin.ExecuteCommand( pSelMenu->GetCurItemId() );
+ return 0;
+}
+
+void SidebarTxtControl::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ if ( !mrSidebarWin.IsProtected() &&
+ GetTextView() &&
+ GetTextView()->IsWrongSpelledWordAtPos( rCEvt.GetMousePosPixel(),TRUE ))
+ {
+ Link aLink = LINK(this, SidebarTxtControl, OnlineSpellCallback);
+ GetTextView()->ExecuteSpellPopup(rCEvt.GetMousePosPixel(),&aLink);
+ }
+ else
+ {
+ SfxPopupMenuManager* aMgr = mrDocView.GetViewFrame()->GetDispatcher()->Popup(0, this,&rCEvt.GetMousePosPixel());
+ ((PopupMenu*)aMgr->GetSVMenu())->SetSelectHdl( LINK(this, SidebarTxtControl, Select) );
+
+ {
+ XubString aText = ((PopupMenu*)aMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR );
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, mrSidebarWin.GetAuthor());
+ aText = aRewriter.Apply(aText);
+ ((PopupMenu*)aMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
+ }
+
+ if (rCEvt.IsMouseEvent())
+ ((PopupMenu*)aMgr->GetSVMenu())->Execute(this,rCEvt.GetMousePosPixel());
+ else
+ {
+ const Size aSize = GetSizePixel();
+ const Point aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 );
+ ((PopupMenu*)aMgr->GetSVMenu())->Execute(this,aPos);
+ }
+ delete aMgr;
+ }
+ }
+ else
+ if (rCEvt.GetCommand() == COMMAND_WHEEL)
+ {
+ if (mrSidebarWin.IsScrollbarVisible())
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if (pData->IsShift() || pData->IsMod1() || pData->IsMod2())
+ {
+ mrDocView.HandleWheelCommands(rCEvt);
+ }
+ else
+ {
+ HandleScrollCommand( rCEvt, 0 , mrSidebarWin.Scrollbar());
+ }
+ }
+ else
+ {
+ mrDocView.HandleWheelCommands(rCEvt);
+ }
+ }
+ else
+ {
+ if ( GetTextView() )
+ GetTextView()->Command( rCEvt );
+ else
+ Window::Command(rCEvt);
+ }
+}
+
+XubString SidebarTxtControl::GetSurroundingText() const
+{
+ if( GetTextView() )
+ return GetTextView()->GetSurroundingText();
+ else
+ return XubString::EmptyString();
+}
+
+Selection SidebarTxtControl::GetSurroundingTextSelection() const
+{
+ if( GetTextView() )
+ return GetTextView()->GetSurroundingTextSelection();
+ else
+ return Selection( 0, 0 );
+}
+
+css::uno::Reference< css::accessibility::XAccessible > SidebarTxtControl::CreateAccessible()
+{
+
+ SidebarTxtControlAccessible* pAcc( new SidebarTxtControlAccessible( *this ) );
+ css::uno::Reference< css::awt::XWindowPeer > xWinPeer( pAcc );
+ SetWindowPeer( xWinPeer, pAcc );
+
+ css::uno::Reference< css::accessibility::XAccessible > xAcc( xWinPeer, css::uno::UNO_QUERY );
+ return xAcc;
+}
+
+} } // end of namespace sw::sidebarwindows
+
diff --git a/sw/source/ui/docvw/SidebarTxtControl.hxx b/sw/source/ui/docvw/SidebarTxtControl.hxx
new file mode 100644
index 000000000000..08a5de0003c4
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarTxtControl.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SIDEBARTXTCONTROL_HXX
+#define _SIDEBARTXTCONTROL_HXX
+
+#include <vcl/ctrl.hxx>
+
+class OutlinerView;
+class SwView;
+class SwPostItMgr;
+class SpellCallbackInfo;
+
+namespace sw { namespace sidebarwindows {
+
+class SwSidebarWin;
+
+class SidebarTxtControl : public Control
+{
+ private:
+ SwSidebarWin& mrSidebarWin;
+ SwView& mrDocView;
+ SwPostItMgr& mrPostItMgr;
+
+ bool mbMouseOver;
+
+ protected:
+ virtual void Paint( const Rectangle& rRect);
+ virtual void KeyInput( const KeyEvent& rKeyEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void LoseFocus();
+ virtual void RequestHelp(const HelpEvent &rEvt);
+ virtual XubString GetSurroundingText() const;
+ virtual Selection GetSurroundingTextSelection() const;
+
+ DECL_LINK( Select, Menu* );
+
+ public:
+ SidebarTxtControl( SwSidebarWin& rSidebarWin,
+ WinBits nBits,
+ SwView& rDocView,
+ SwPostItMgr& rPostItMgr );
+ ~SidebarTxtControl();
+
+ virtual void GetFocus();
+
+ OutlinerView* GetTextView() const;
+
+ DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+};
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/docvw/SidebarTxtControlAcc.cxx b/sw/source/ui/docvw/SidebarTxtControlAcc.cxx
new file mode 100644
index 000000000000..8b0f0293367c
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarTxtControlAcc.cxx
@@ -0,0 +1,317 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <SidebarTxtControlAcc.hxx>
+
+#include <SidebarTxtControl.hxx>
+
+#include <svl/brdcst.hxx>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <editeng/unoedsrc.hxx>
+#include <editeng/unoforou.hxx>
+#include <editeng/unoviwou.hxx>
+#include <editeng/unoedhlp.hxx>
+#include <svx/AccessibleTextHelper.hxx>
+#include <editeng/outliner.hxx>
+
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace sidebarwindows {
+
+// =============================================================================
+// declaration and implementation of <SvxEditSource>
+// for <::accessibiliy::AccessibleTextHelper> instance
+// =============================================================================
+class SidebarTextEditSource : public SvxEditSource,
+ public SfxBroadcaster
+{
+ public:
+ SidebarTextEditSource( SidebarTxtControl& rSidebarTxtControl );
+ virtual ~SidebarTextEditSource();
+
+ virtual SvxEditSource* Clone() const;
+
+ virtual SvxTextForwarder* GetTextForwarder();
+ virtual SvxViewForwarder* GetViewForwarder();
+ virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
+
+ virtual void UpdateData();
+
+ virtual SfxBroadcaster& GetBroadcaster() const;
+ DECL_LINK( NotifyHdl, EENotify* );
+
+ private:
+ SidebarTxtControl& mrSidebarTxtControl;
+ SvxOutlinerForwarder mTextForwarder;
+ SvxDrawOutlinerViewForwarder mViewForwarder;
+};
+
+SidebarTextEditSource::SidebarTextEditSource( SidebarTxtControl& rSidebarTxtControl )
+ : SvxEditSource()
+ , mrSidebarTxtControl( rSidebarTxtControl )
+ , mTextForwarder( *(rSidebarTxtControl.GetTextView()->GetOutliner()), NULL )
+ , mViewForwarder( *(rSidebarTxtControl.GetTextView()) )
+{
+ if ( mrSidebarTxtControl.GetTextView() )
+ {
+ mrSidebarTxtControl.GetTextView()->GetOutliner()->SetNotifyHdl( LINK(this, SidebarTextEditSource, NotifyHdl) );
+ }
+}
+
+SidebarTextEditSource::~SidebarTextEditSource()
+{
+ if ( mrSidebarTxtControl.GetTextView() )
+ {
+ mrSidebarTxtControl.GetTextView()->GetOutliner()->SetNotifyHdl( Link() );
+ }
+}
+
+SvxEditSource* SidebarTextEditSource::Clone() const
+{
+ return new SidebarTextEditSource( mrSidebarTxtControl );
+}
+
+SvxTextForwarder* SidebarTextEditSource::GetTextForwarder()
+{
+ return &mTextForwarder;
+}
+
+SvxViewForwarder* SidebarTextEditSource::GetViewForwarder()
+{
+ return &mViewForwarder;
+}
+
+SvxEditViewForwarder* SidebarTextEditSource::GetEditViewForwarder( sal_Bool /*bCreate*/ )
+{
+ return &mViewForwarder;
+}
+
+void SidebarTextEditSource::UpdateData()
+{
+ // nothing to do
+}
+
+SfxBroadcaster& SidebarTextEditSource::GetBroadcaster() const
+{
+ return *( const_cast< SidebarTextEditSource* > (this) );
+}
+
+IMPL_LINK(SidebarTextEditSource, NotifyHdl, EENotify*, pNotify)
+{
+ if ( pNotify )
+ {
+ ::std::auto_ptr< SfxHint > aHint( SvxEditSourceHelper::EENotification2Hint( pNotify ) );
+
+ if( aHint.get() )
+ {
+ Broadcast( *aHint.get() );
+ }
+ }
+
+ return 0;
+}
+
+
+// =============================================================================
+// declaration and implementation of accessible context for <SidebarTxtControl> instance
+// =============================================================================
+class SidebarTxtControlAccessibleContext : public VCLXAccessibleComponent
+{
+ public:
+ explicit SidebarTxtControlAccessibleContext( SidebarTxtControl& rSidebarTxtControl );
+ virtual ~SidebarTxtControlAccessibleContext();
+
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 i )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ using WeakAggComponentImplHelperBase::addEventListener;
+ using WeakAggComponentImplHelperBase::removeEventListener;
+
+ virtual void SAL_CALL
+ addEventListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL
+ removeEventListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+
+ private:
+ SidebarTxtControl& mrSidebarTxtControl;
+ ::accessibility::AccessibleTextHelper* mpAccessibleTextHelper;
+
+ ::vos::OMutex maMutex;
+
+ void defunc();
+};
+
+SidebarTxtControlAccessibleContext::SidebarTxtControlAccessibleContext( SidebarTxtControl& rSidebarTxtControl )
+ : VCLXAccessibleComponent( rSidebarTxtControl.GetWindowPeer() )
+ , mrSidebarTxtControl( rSidebarTxtControl )
+ , mpAccessibleTextHelper( 0 )
+ , maMutex()
+{
+ ::std::auto_ptr<SvxEditSource> pEditSource(
+ new SidebarTextEditSource( mrSidebarTxtControl ) );
+ mpAccessibleTextHelper = new ::accessibility::AccessibleTextHelper( pEditSource );
+ mpAccessibleTextHelper->SetEventSource( mrSidebarTxtControl.GetWindowPeer() );
+}
+
+SidebarTxtControlAccessibleContext::~SidebarTxtControlAccessibleContext()
+{
+ defunc();
+}
+
+void SidebarTxtControlAccessibleContext::defunc()
+{
+ delete mpAccessibleTextHelper;
+ mpAccessibleTextHelper = 0;
+}
+
+sal_Int32 SAL_CALL SidebarTxtControlAccessibleContext::getAccessibleChildCount()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aGuard( maMutex );
+
+ sal_Int32 nChildCount( 0 );
+
+ if ( mpAccessibleTextHelper )
+ {
+ nChildCount = mpAccessibleTextHelper->GetChildCount();
+ }
+
+ return nChildCount;
+}
+
+css::uno::Reference< css::accessibility::XAccessible > SAL_CALL SidebarTxtControlAccessibleContext::getAccessibleChild( sal_Int32 i )
+ throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException )
+{
+ vos::OGuard aGuard( maMutex );
+
+ css::uno::Reference< css::accessibility::XAccessible > xChild;
+
+ if ( mpAccessibleTextHelper )
+ {
+ xChild = mpAccessibleTextHelper->GetChild( i );
+ }
+
+ return xChild;
+}
+
+void SAL_CALL SidebarTxtControlAccessibleContext::addEventListener (
+ const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener)
+ throw (css::uno::RuntimeException)
+{
+ vos::OGuard aGuard( maMutex );
+
+ if ( mpAccessibleTextHelper )
+ {
+ mpAccessibleTextHelper->AddEventListener(xListener);
+ }
+}
+
+void SAL_CALL SidebarTxtControlAccessibleContext::removeEventListener (
+ const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener)
+ throw (css::uno::RuntimeException)
+{
+ vos::OGuard aGuard( maMutex );
+
+ if ( mpAccessibleTextHelper )
+ {
+ mpAccessibleTextHelper->RemoveEventListener(xListener);
+ }
+}
+
+void SidebarTxtControlAccessibleContext::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ if ( mpAccessibleTextHelper )
+ {
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_OBJECT_DYING:
+ {
+ defunc();
+ }
+ break;
+ case VCLEVENT_WINDOW_GETFOCUS:
+ case VCLEVENT_CONTROL_GETFOCUS:
+ {
+ mpAccessibleTextHelper->SetFocus( sal_True );
+ }
+ break;
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ case VCLEVENT_CONTROL_LOSEFOCUS:
+ {
+ mpAccessibleTextHelper->SetFocus( sal_False );
+ }
+ break;
+ }
+ }
+
+ VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+}
+
+// =============================================================================
+// implementaion of accessible for <SidebarTxtControl> instance
+// =============================================================================
+SidebarTxtControlAccessible::SidebarTxtControlAccessible( SidebarTxtControl& rSidebarTxtControl )
+ : VCLXWindow()
+ , mrSidebarTxtControl( rSidebarTxtControl )
+{
+ SetWindow( &mrSidebarTxtControl );
+}
+
+SidebarTxtControlAccessible::~SidebarTxtControlAccessible()
+{
+}
+
+css::uno::Reference< css::accessibility::XAccessibleContext > SidebarTxtControlAccessible::CreateAccessibleContext()
+{
+ SidebarTxtControlAccessibleContext* pAccContext(
+ new SidebarTxtControlAccessibleContext( mrSidebarTxtControl ) );
+ css::uno::Reference< css::accessibility::XAccessibleContext > xAcc( pAccContext );
+ return xAcc;
+}
+
+} } // end of namespace sw::sidebarwindows
+
diff --git a/sw/source/ui/inc/tbxmgr.hxx b/sw/source/ui/docvw/SidebarTxtControlAcc.hxx
index 43798be42de1..57edc50512d5 100644
--- a/sw/source/ui/inc/tbxmgr.hxx
+++ b/sw/source/ui/docvw/SidebarTxtControlAcc.hxx
@@ -2,10 +2,14 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -24,29 +28,29 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _TBXMGR_HXX
-#define _TBXMGR_HXX
-#include <svx/tbxdraw.hxx>
-/*
-class SwPopupWindowTbxMgr : public SvxPopupWindowTbxMgr
+#ifndef _SIDEBARTXTCONTROLACC_HXX
+#define _SIDEBARTXTCONTROLACC_HXX
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+namespace sw { namespace sidebarwindows {
+
+class SidebarTxtControl;
+
+class SidebarTxtControlAccessible : public VCLXWindow
{
- BOOL bWeb:1; //gilt der WebMode?
- ResId aRIdWinTemp;
- ResId aRIdTbxTemp;
- WindowAlign eAlignment;
- SfxBindings& mrBindings;
-
-public:
- SwPopupWindowTbxMgr( USHORT nId,
- WindowAlign eAlign,
- ResId aRIdWin,
- ResId aRIdTbx,
- SfxBindings& rBindings );
-
- virtual void StateChanged(USHORT nSID, SfxItemState eState, const SfxPoolItem* pState);
- virtual SfxPopupWindow* Clone() const;
+ public:
+ explicit SidebarTxtControlAccessible( SidebarTxtControl& rSidebarTxtControl );
+ virtual ~SidebarTxtControlAccessible();
+
+ virtual com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessibleContext >
+ CreateAccessibleContext();
+
+ private:
+ SidebarTxtControl& mrSidebarTxtControl;
};
-*/
-#endif // _TBX_DRAW_HXX
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/docvw/SidebarWin.cxx b/sw/source/ui/docvw/SidebarWin.cxx
new file mode 100644
index 000000000000..cce6db3a891b
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarWin.cxx
@@ -0,0 +1,1373 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sw.hxx"
+
+#include <SidebarWin.hxx>
+#include <SidebarWinAcc.hxx>
+#include <PostItMgr.hxx>
+
+#include <SidebarTxtControl.hxx>
+#include <AnchorOverlayObject.hxx>
+#include <ShadowOverlayObject.hxx>
+
+#include <annotation.hrc>
+#include <popup.hrc>
+#include <docvw.hrc>
+#include <app.hrc>
+#include <access.hrc>
+
+#include <viewopt.hxx>
+#include <cmdid.h>
+
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/editview.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/eeitem.hxx>
+
+#include <svl/zforlist.hxx>
+#include <svl/undo.hxx>
+#include <svl/stritem.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <vcl/scrbar.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/menubtn.hxx>
+
+#include <edtwin.hxx>
+#include <view.hxx>
+#include <docsh.hxx>
+#include <wrtsh.hxx>
+#include <doc.hxx>
+#include <swmodule.hxx>
+#include <langhelper.hxx>
+
+#include <sw_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace sidebarwindows {
+
+#define METABUTTON_WIDTH 16
+#define METABUTTON_HEIGHT 18
+#define METABUTTON_AREA_WIDTH 30
+#define POSTIT_META_HEIGHT (sal_Int32) 30
+#define POSTIT_MINIMUMSIZE_WITHOUT_META 50
+
+#define POSTIT_SHADOW_BRIGHT Color(180,180,180)
+#define POSTIT_SHADOW_DARK Color(83,83,83)
+
+#define EMPTYSTRING rtl::OUString::createFromAscii("")
+
+/************** SwSidebarWin************************************/
+SwSidebarWin::SwSidebarWin( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits,
+ SwSidebarItem& rSidebarItem )
+ : Window(&rEditWin, nBits)
+ , mrMgr(aMgr)
+ , mrView( rEditWin.GetView() )
+ , nFlags(aBits)
+ , mnEventId(0)
+ , mpOutlinerView(0)
+ , mpOutliner(0)
+ , mpSidebarTxtControl(0)
+ , mpVScrollbar(0)
+ , mpMetadataAuthor(0)
+ , mpMetadataDate(0)
+ , mpMenuButton(0)
+ , mpAnchor(0)
+ , mpShadow(0)
+ , mColorAnchor()
+ , mColorDark()
+ , mColorLight()
+ , mChangeColor()
+ , meSidebarPosition( sw::sidebarwindows::SIDEBAR_NONE )
+ , mPosSize()
+ , mAnchorRect()
+ , mPageBorder( 0 )
+ , mbMouseOver( false )
+ , mLayoutStatus( SwPostItHelper::INVISIBLE )
+ , mbReadonly( false )
+ , mbIsFollow( false )
+ , mrSidebarItem( rSidebarItem )
+ , mpAnchorFrm( rSidebarItem.maLayoutInfo.mpAnchorFrm )
+{
+ mpShadow = ShadowOverlayObject::CreateShadowOverlayObject( mrView );
+ if ( mpShadow )
+ {
+ mpShadow->setVisible(false);
+ }
+
+ mrMgr.ConnectSidebarWinToFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm),
+ *(mrSidebarItem.GetFmtFld()),
+ *this );
+}
+
+SwSidebarWin::~SwSidebarWin()
+{
+ mrMgr.DisconnectSidebarWinFromFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm),
+ *this );
+
+ Disable();
+
+ if ( mpSidebarTxtControl )
+ {
+ if ( mpOutlinerView )
+ {
+ mpOutlinerView->SetWindow( 0 );
+ }
+ delete mpSidebarTxtControl;
+ mpSidebarTxtControl = 0;
+ }
+
+ if ( mpOutlinerView )
+ {
+ delete mpOutlinerView;
+ mpOutlinerView = 0;
+ }
+
+ if (mpOutliner)
+ {
+ delete mpOutliner;
+ mpOutliner = 0;
+ }
+
+ if (mpMetadataAuthor)
+ {
+ mpMetadataAuthor->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ delete mpMetadataAuthor;
+ mpMetadataAuthor = 0;
+ }
+
+ if (mpMetadataDate)
+ {
+ mpMetadataDate->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ delete mpMetadataDate;
+ mpMetadataDate = 0;
+ }
+
+ if (mpVScrollbar)
+ {
+ mpVScrollbar->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ delete mpVScrollbar;
+ mpVScrollbar = 0;
+ }
+
+ AnchorOverlayObject::DestroyAnchorOverlayObject( mpAnchor );
+ mpAnchor = 0;
+
+ ShadowOverlayObject::DestroyShadowOverlayObject( mpShadow );
+ mpShadow = 0;
+
+ delete mpMenuButton;
+ mpMenuButton = 0;
+
+ if (mnEventId)
+ Application::RemoveUserEvent( mnEventId );
+}
+
+void SwSidebarWin::Paint( const Rectangle& rRect)
+{
+ Window::Paint(rRect);
+
+ if (mpMetadataAuthor->IsVisible() )
+ {
+ //draw left over space
+ if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ SetFillColor(COL_BLACK);
+ }
+ else
+ {
+ SetFillColor(mColorDark);
+ }
+ SetLineColor();
+ DrawRect( PixelToLogic(
+ Rectangle( Point( mpMetadataAuthor->GetPosPixel().X() +
+ mpMetadataAuthor->GetSizePixel().Width(),
+ mpMetadataAuthor->GetPosPixel().Y() ),
+ Size( GetMetaButtonAreaWidth(),
+ mpMetadataAuthor->GetSizePixel().Height() +
+ mpMetadataDate->GetSizePixel().Height() ) ) ) );
+ }
+}
+
+void SwSidebarWin::SetPosSizePixelRect( long nX,
+ long nY,
+ long nWidth,
+ long nHeight,
+ const SwRect &aRect,
+ const long aPageBorder)
+{
+ mPosSize = Rectangle(Point(nX,nY),Size(nWidth,nHeight));
+ mAnchorRect = aRect;
+ mPageBorder = aPageBorder;
+}
+
+void SwSidebarWin::SetSize( const Size& rNewSize )
+{
+ mPosSize.SetSize(rNewSize);
+}
+
+void SwSidebarWin::SetVirtualPosSize( const Point& aPoint, const Size& aSize)
+{
+ mPosSize = Rectangle(aPoint,aSize);
+}
+
+void SwSidebarWin::TranslateTopPosition(const long aAmount)
+{
+ mPosSize.Move(0,aAmount);
+}
+
+void SwSidebarWin::ShowAnchorOnly(const Point &aPoint)
+{
+ HideNote();
+ SetPosAndSize();
+ if (mpAnchor)
+ {
+ mpAnchor->SetSixthPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
+ mpAnchor->SetSeventhPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
+ mpAnchor->SetAnchorState(AS_ALL);
+ mpAnchor->setVisible(true);
+ }
+ if (mpShadow)
+ mpShadow->setVisible(false);
+}
+
+SfxItemSet SwSidebarWin::DefaultItem()
+{
+ SfxItemSet aItem( mrView.GetDocShell()->GetPool() );
+ aItem.Put(SvxFontHeightItem(200,100,EE_CHAR_FONTHEIGHT));
+ aItem.Put(SvxFontItem(FAMILY_SWISS,GetSettings().GetStyleSettings().GetFieldFont().GetName(),
+ EMPTYSTRING,PITCH_DONTKNOW,RTL_TEXTENCODING_DONTKNOW,EE_CHAR_FONTINFO));
+ return aItem;
+}
+
+void SwSidebarWin::InitControls()
+{
+ AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+
+ // actual window which holds the user text
+ mpSidebarTxtControl = new SidebarTxtControl( *this,
+ WB_NODIALOGCONTROL,
+ mrView, mrMgr );
+ mpSidebarTxtControl->SetPointer(Pointer(POINTER_TEXT));
+
+ // window controls for author and date
+ mpMetadataAuthor = new Edit( this, 0 );
+ mpMetadataAuthor->SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_AUTHOR_NAME ) );
+ mpMetadataAuthor->SetReadOnly();
+ mpMetadataAuthor->AlwaysDisableInput(true);
+ mpMetadataAuthor->SetCallHandlersOnInputDisabled(true);
+ mpMetadataAuthor->AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ // we should leave this setting alone, but for this we need a better layout algo
+ // with variable meta size height
+ {
+ AllSettings aSettings = mpMetadataAuthor->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ Font aFont = aStyleSettings.GetFieldFont();
+ aFont.SetHeight(8);
+ aStyleSettings.SetFieldFont(aFont);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMetadataAuthor->SetSettings(aSettings);
+ }
+
+ mpMetadataDate = new Edit( this, 0 );
+ mpMetadataDate->SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_DATE_NAME ) );
+ mpMetadataDate->SetReadOnly();
+ mpMetadataDate->AlwaysDisableInput(true);
+ mpMetadataDate->SetCallHandlersOnInputDisabled(true);
+ mpMetadataDate->AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ // we should leave this setting alone, but for this we need a better layout algo
+ // with variable meta size height
+ {
+ AllSettings aSettings = mpMetadataDate->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ Font aFont = aStyleSettings.GetFieldFont();
+ aFont.SetHeight(8);
+ aStyleSettings.SetFieldFont(aFont);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMetadataDate->SetSettings(aSettings);
+ }
+
+
+ SwDocShell* aShell = mrView.GetDocShell();
+ mpOutliner = new Outliner(&aShell->GetPool(),OUTLINERMODE_TEXTOBJECT);
+ aShell->GetDoc()->SetCalcFieldValueHdl( mpOutliner );
+ mpOutliner->SetUpdateMode( TRUE );
+ Rescale();
+
+ OutputDevice* pDev = aShell->GetDoc()->getReferenceDevice(TRUE);
+ if ( pDev )
+ {
+ mpOutliner->SetRefDevice( pDev );
+ }
+
+ mpOutlinerView = new OutlinerView ( mpOutliner, mpSidebarTxtControl );
+ mpOutlinerView->SetBackgroundColor(COL_TRANSPARENT);
+ mpOutliner->InsertView(mpOutlinerView );
+ mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,1,1) ) );
+
+ mpOutlinerView->SetAttribs(DefaultItem());
+
+ // TODO: ??
+ EEHorizontalTextDirection aDefHoriTextDir = Application::GetSettings().GetLayoutRTL() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
+ mpOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir );
+
+ //create Scrollbars
+ mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
+ mpVScrollbar->EnableNativeWidget(false);
+ mpVScrollbar->EnableRTL( false );
+ mpVScrollbar->SetScrollHdl(LINK(this, SwSidebarWin, ScrollHdl));
+ mpVScrollbar->EnableDrag();
+ mpVScrollbar->AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+
+ const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
+ ULONG nCntrl = mpOutliner->GetControlWord();
+ // TODO: crash when AUTOCOMPLETE enabled
+ nCntrl |= EE_CNTRL_MARKFIELDS | EE_CNTRL_PASTESPECIAL | EE_CNTRL_AUTOCORRECT | EV_CNTRL_AUTOSCROLL | EE_CNTRL_URLSFXEXECUTE; // | EE_CNTRL_AUTOCOMPLETE;
+ if (pVOpt->IsFieldShadings())
+ nCntrl |= EE_CNTRL_MARKFIELDS;
+ else
+ nCntrl &= ~EE_CNTRL_MARKFIELDS;
+ if (pVOpt->IsOnlineSpell())
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ mpOutliner->SetControlWord(nCntrl);
+
+ sal_uInt16 aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor());
+ SetColor( mrMgr.GetColorDark(aIndex),
+ mrMgr.GetColorLight(aIndex),
+ mrMgr.GetColorAnchor(aIndex));
+
+ CheckMetaText();
+
+ mpMenuButton = CreateMenuButton();
+
+ SetLanguage(GetLanguage());
+ GetOutlinerView()->StartSpeller();
+ SetPostItText();
+ Engine()->CompleteOnlineSpelling();
+
+ mpSidebarTxtControl->Show();
+ mpMetadataAuthor->Show();
+ mpMetadataDate->Show();
+ mpVScrollbar->Show();
+}
+
+void SwSidebarWin::CheckMetaText()
+{
+ const LocaleDataWrapper& rLocalData = SvtSysLocale().GetLocaleData();
+ String sMeta = GetAuthor();
+ if (sMeta.Len() == 0)
+ {
+ sMeta = String(SW_RES(STR_NOAUTHOR));
+ }
+ else if (sMeta.Len() > 22)
+ {
+ sMeta.Erase(20);
+ sMeta = sMeta + rtl::OUString::createFromAscii("...");
+ }
+ if ( mpMetadataAuthor->GetText() != sMeta )
+ {
+ mpMetadataAuthor->SetText(sMeta);
+ }
+
+ Date aDate = GetDate();
+ if (aDate==Date())
+ {
+ sMeta = String(SW_RES(STR_POSTIT_TODAY));
+ }
+ else if (aDate == Date(Date()-1))
+ {
+ sMeta = String(SW_RES(STR_POSTIT_YESTERDAY));
+ }
+ else if (aDate.IsValid() )
+ {
+ sMeta = rLocalData.getDate(aDate);
+ }
+ else
+ {
+ sMeta = String(SW_RES(STR_NODATE));
+ }
+ if (GetTime()!=0)
+ {
+ sMeta = sMeta + rtl::OUString::createFromAscii(" ") + rLocalData.getTime( GetTime(),false );
+ }
+ if ( mpMetadataDate->GetText() != sMeta )
+ {
+ mpMetadataDate->SetText(sMeta);
+ }
+
+}
+
+void SwSidebarWin::Rescale()
+{
+ MapMode aMode = GetParent()->GetMapMode();
+ aMode.SetOrigin( Point() );
+ mpOutliner->SetRefMapMode( aMode );
+ SetMapMode( aMode );
+ mpSidebarTxtControl->SetMapMode( aMode );
+ if ( mpMetadataAuthor )
+ {
+ Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetFieldFont() );
+ sal_Int32 nHeight = aFont.GetHeight();
+ nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
+ aFont.SetHeight( nHeight );
+ mpMetadataAuthor->SetControlFont( aFont );
+ }
+ if ( mpMetadataDate )
+ {
+ Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() );
+ sal_Int32 nHeight = aFont.GetHeight();
+ nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
+ aFont.SetHeight( nHeight );
+ mpMetadataDate->SetControlFont( aFont );
+ }
+}
+
+void SwSidebarWin::SetPosAndSize()
+{
+ bool bChange = false;
+
+ if (GetSizePixel() != mPosSize.GetSize())
+ {
+ bChange = true;
+ SetSizePixel(mPosSize.GetSize());
+ DoResize();
+ }
+
+ if (GetPosPixel().X() != mPosSize.TopLeft().X() || (abs(GetPosPixel().Y() - mPosSize.TopLeft().Y()) > 5) )
+ {
+ bChange = true;
+ SetPosPixel(mPosSize.TopLeft());
+
+ Point aLineStart;
+ Point aLineEnd ;
+ switch ( meSidebarPosition )
+ {
+ case sw::sidebarwindows::SIDEBAR_LEFT:
+ {
+ aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
+ aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
+ }
+ break;
+ case sw::sidebarwindows::SIDEBAR_RIGHT:
+ {
+ aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
+ aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
+ }
+ break;
+ default:
+ ASSERT( false,
+ "<SwSidebarWin::SetPosAndSize()> - unexpected position of sidebar" );
+ break;
+ }
+
+ if (!IsPreview())
+ {
+ if (mpAnchor)
+ {
+ mpAnchor->SetAllPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
+ basegfx::B2DPoint( mAnchorRect.Left()-5*15 , mAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( mAnchorRect.Left()+5*15 , mAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( mAnchorRect.Left(), mAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( mPageBorder ,mAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
+ basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()));
+ mpAnchor->SetHeight(mAnchorRect.Height());
+ }
+ else
+ {
+ mpAnchor = AnchorOverlayObject::CreateAnchorOverlayObject( mrView,
+ mAnchorRect,
+ mPageBorder,
+ aLineStart,
+ aLineEnd,
+ mColorAnchor );
+ if ( mpAnchor )
+ {
+ mpAnchor->SetHeight(mAnchorRect.Height());
+ mpAnchor->setVisible(true);
+ mpAnchor->SetAnchorState(AS_TRI);
+ if (HasChildPathFocus())
+ {
+ mpAnchor->setLineSolid(true);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( mpAnchor &&
+ ( mpAnchor->getBasePosition() != basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom()-5*15) ) )
+ {
+ mpAnchor->SetTriPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
+ basegfx::B2DPoint( mAnchorRect.Left()-5*15 , mAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( mAnchorRect.Left()+5*15 , mAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( mAnchorRect.Left(), mAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( mPageBorder , mAnchorRect.Bottom()+2*15));
+ }
+ }
+
+ if (bChange)
+ {
+ Point aStart = EditWin()->PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height()));
+ Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height()));
+ mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
+ }
+
+ if (mrMgr.ShowNotes())
+ {
+ if (IsFollow() && !HasChildPathFocus())
+ {
+ mpAnchor->SetAnchorState(AS_END);
+ }
+ else
+ {
+ mpAnchor->SetAnchorState(AS_ALL);
+ SwSidebarWin* pWin = GetTopReplyNote();
+ if (pWin)
+ pWin->Anchor()->SetAnchorState(AS_END);
+ }
+ }
+}
+
+void SwSidebarWin::DoResize()
+{
+ long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height();
+ long aHeight = GetSizePixel().Height();
+ unsigned long aWidth = GetSizePixel().Width();
+
+ aHeight -= GetMetaHeight();
+ mpMetadataAuthor->Show();
+ mpMetadataDate->Show();
+ mpSidebarTxtControl->SetQuickHelpText(EMPTYSTRING);
+
+ if ((aTextHeight > aHeight) && !IsPreview())
+ { // we need vertical scrollbars and have to reduce the width
+ aWidth -= GetScrollbarWidth();
+ mpVScrollbar->Show();
+ }
+ else
+ {
+ mpVScrollbar->Hide();
+ }
+
+ {
+ const Size aSizeOfMetadataControls( GetSizePixel().Width() - GetMetaButtonAreaWidth(),
+ GetMetaHeight()/2 );
+ mpMetadataAuthor->SetPosSizePixel( 0,
+ aHeight,
+ aSizeOfMetadataControls.Width(),
+ aSizeOfMetadataControls.Height() );
+ mpMetadataDate->SetPosSizePixel( 0,
+ aHeight + aSizeOfMetadataControls.Height(),
+ aSizeOfMetadataControls.Width(),
+ aSizeOfMetadataControls.Height() );
+ }
+
+ mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ;
+ mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
+ if (!mpVScrollbar->IsVisible())
+ { // if we do not have a scrollbar anymore, we want to see the complete text
+ mpOutlinerView->SetVisArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
+ }
+
+ if (!Application::GetSettings().GetLayoutRTL())
+ {
+ mpSidebarTxtControl->SetPosSizePixel(0, 0, aWidth, aHeight);
+ mpVScrollbar->SetPosSizePixel( aWidth, 0, GetScrollbarWidth(), aHeight);
+ }
+ else
+ {
+ mpSidebarTxtControl->SetPosSizePixel( ( (aTextHeight > aHeight) && !IsPreview()
+ ? GetScrollbarWidth() : 0 ) , 0,
+ aWidth, aHeight);
+ mpVScrollbar->SetPosSizePixel( 0, 0, GetScrollbarWidth(), aHeight);
+ }
+
+ mpVScrollbar->SetVisibleSize( PixelToLogic(Size(0,aHeight)).Height() );
+ mpVScrollbar->SetPageSize( PixelToLogic(Size(0,aHeight)).Height() * 8 / 10 );
+ mpVScrollbar->SetLineSize( mpOutliner->GetTextHeight() / 10 );
+ SetScrollbar();
+ mpVScrollbar->SetRange( Range(0, mpOutliner->GetTextHeight()));
+
+ //calculate rects for meta- button
+ const Fraction& fx( GetMapMode().GetScaleX() );
+ const Fraction& fy( GetMapMode().GetScaleY() );
+
+ const Point aPos( mpMetadataAuthor->GetPosPixel());
+ Rectangle aRectMetaButton;
+ if (IsPreview())
+ {
+ aRectMetaButton = PixelToLogic(
+ Rectangle( Point( aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH*4+10)*fx.GetNumerator()/fx.GetDenominator(),
+ aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ),
+ Size( METABUTTON_WIDTH*4*fx.GetNumerator()/fx.GetDenominator(),
+ METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) );
+ }
+ else
+ {
+ aRectMetaButton = PixelToLogic(
+ Rectangle( Point( aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx.GetNumerator()/fx.GetDenominator(),
+ aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ),
+ Size( METABUTTON_WIDTH*fx.GetNumerator()/fx.GetDenominator(),
+ METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) );
+ }
+
+ {
+ const Rectangle aRectMetaButtonPixel( LogicToPixel( aRectMetaButton ) );
+ mpMenuButton->SetPosSizePixel( aRectMetaButtonPixel.Left(),
+ aRectMetaButtonPixel.Top(),
+ aRectMetaButtonPixel.GetWidth(),
+ aRectMetaButtonPixel.GetHeight() );
+ }
+}
+
+void SwSidebarWin::SetSizePixel( const Size& rNewSize )
+{
+ Window::SetSizePixel(rNewSize);
+
+ if (mpShadow)
+ {
+ Point aStart = EditWin()->PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height()));
+ Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height()));
+ mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
+ }
+}
+
+void SwSidebarWin::SetScrollbar()
+{
+ mpVScrollbar->SetThumbPos( mpOutlinerView->GetVisArea().Top()+ mpOutlinerView->GetEditView().GetCursor()->GetOffsetY());
+}
+
+void SwSidebarWin::ResizeIfNeccessary(long aOldHeight, long aNewHeight)
+{
+ if (aOldHeight != aNewHeight)
+ {
+ //check for lower border or next note
+ long aBorder = mrMgr.GetNextBorder();
+ if (aBorder != -1)
+ {
+ if (aNewHeight > GetMinimumSizeWithoutMeta())
+ {
+ long aNewLowerValue = GetPosPixel().Y() + aNewHeight + GetMetaHeight();
+ if (aNewLowerValue < aBorder)
+ SetSizePixel(Size(GetSizePixel().Width(),aNewHeight+GetMetaHeight()));
+ else
+ SetSizePixel(Size(GetSizePixel().Width(),aBorder - GetPosPixel().Y()));
+ DoResize();
+ Invalidate();
+ }
+ else
+ {
+ if (GetSizePixel().Height() != GetMinimumSizeWithoutMeta() + GetMetaHeight())
+ SetSizePixel(Size(GetSizePixel().Width(),GetMinimumSizeWithoutMeta() + GetMetaHeight()));
+ DoResize();
+ Invalidate();
+ }
+ }
+ else
+ {
+ DoResize();
+ Invalidate();
+ }
+ }
+ else
+ {
+ SetScrollbar();
+ }
+}
+
+void SwSidebarWin::SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor)
+{
+ mColorDark = aColorDark;
+ mColorLight = aColorLight;
+ mColorAnchor = aColorAnchor;
+
+ if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ {
+ mpMetadataAuthor->SetControlBackground(mColorDark);
+ AllSettings aSettings = mpMetadataAuthor->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ aStyleSettings.SetFieldTextColor(aColorAnchor);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMetadataAuthor->SetSettings(aSettings);
+ }
+
+ {
+ mpMetadataDate->SetControlBackground(mColorDark);
+ AllSettings aSettings = mpMetadataDate->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ aStyleSettings.SetFieldTextColor(aColorAnchor);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMetadataDate->SetSettings(aSettings);
+ }
+
+ AllSettings aSettings2 = mpVScrollbar->GetSettings();
+ StyleSettings aStyleSettings2 = aSettings2.GetStyleSettings();
+ aStyleSettings2.SetButtonTextColor(Color(0,0,0));
+ aStyleSettings2.SetCheckedColor(mColorLight); //hintergund
+ aStyleSettings2.SetShadowColor(mColorAnchor);
+ aStyleSettings2.SetFaceColor(mColorDark);
+ aSettings2.SetStyleSettings(aStyleSettings2);
+ mpVScrollbar->SetSettings(aSettings2);
+ }
+}
+
+void SwSidebarWin::SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition)
+{
+ meSidebarPosition = eSidebarPosition;
+}
+
+void SwSidebarWin::SetReadonly(BOOL bSet)
+{
+ mbReadonly = bSet;
+ GetOutlinerView()->SetReadOnly(bSet);
+}
+
+void SwSidebarWin::SetLanguage(const SvxLanguageItem aNewItem)
+{
+ Link pLink = Engine()->GetModifyHdl();
+ Engine()->SetModifyHdl( Link() );
+ ESelection aOld = GetOutlinerView()->GetSelection();
+
+ ESelection aNewSelection( 0, 0, (USHORT)Engine()->GetParagraphCount()-1, USHRT_MAX );
+ GetOutlinerView()->SetSelection( aNewSelection );
+ SfxItemSet aEditAttr(GetOutlinerView()->GetAttribs());
+ aEditAttr.Put(aNewItem);
+ GetOutlinerView()->SetAttribs( aEditAttr );
+
+ GetOutlinerView()->SetSelection(aOld);
+ Engine()->SetModifyHdl( pLink );
+
+ const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
+ ULONG nCntrl = Engine()->GetControlWord();
+ // turn off
+ if (!pVOpt->IsOnlineSpell())
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ Engine()->SetControlWord(nCntrl);
+
+ //turn back on
+ if (pVOpt->IsOnlineSpell())
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ Engine()->SetControlWord(nCntrl);
+
+ Engine()->CompleteOnlineSpelling();
+ Invalidate();
+}
+
+void SwSidebarWin::DataChanged( const DataChangedEvent& aEvent)
+{
+ Window::DataChanged( aEvent );
+}
+
+void SwSidebarWin::GetFocus()
+{
+ if (mpSidebarTxtControl)
+ mpSidebarTxtControl->GrabFocus();
+}
+
+void SwSidebarWin::LoseFocus()
+{
+}
+
+void SwSidebarWin::ShowNote()
+{
+ SetPosAndSize();
+ if (!IsVisible())
+ Window::Show();
+ if (mpShadow && !mpShadow->isVisible())
+ mpShadow->setVisible(true);
+ if (mpAnchor && !mpAnchor->isVisible())
+ mpAnchor->setVisible(true);
+}
+
+void SwSidebarWin::HideNote()
+{
+ if (IsVisible())
+ Window::Hide();
+ if (mpAnchor)
+ {
+ if (mrMgr.IsShowAnchor())
+ mpAnchor->SetAnchorState(AS_TRI);
+ else
+ mpAnchor->setVisible(false);
+ }
+ if (mpShadow && mpShadow->isVisible())
+ mpShadow->setVisible(false);
+}
+
+void SwSidebarWin::ActivatePostIt()
+{
+ mrMgr.AssureStdModeAtShell();
+
+ mpOutliner->ClearModifyFlag();
+ mpOutliner->GetUndoManager().Clear();
+
+ CheckMetaText();
+ SetViewState(VS_EDIT);
+ GetOutlinerView()->ShowCursor();
+
+ mpOutlinerView->GetEditView().SetInsertMode(mrView.GetWrtShellPtr()->IsInsMode());
+
+ if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ GetOutlinerView()->SetBackgroundColor(mColorDark);
+}
+
+void SwSidebarWin::DeactivatePostIt()
+{
+ // remove selection, #i87073#
+ if (GetOutlinerView()->GetEditView().HasSelection())
+ {
+ ESelection aSelection = GetOutlinerView()->GetEditView().GetSelection();
+ aSelection.nEndPara = aSelection.nStartPara;
+ aSelection.nEndPos = aSelection.nStartPos;
+ GetOutlinerView()->GetEditView().SetSelection(aSelection);
+ }
+
+ mpOutliner->CompleteOnlineSpelling();
+
+ SetViewState(VS_NORMAL);
+ // write the visible text back into the SwField
+ UpdateData();
+
+ if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ GetOutlinerView()->SetBackgroundColor(COL_TRANSPARENT);
+
+
+ if ( !IsProtected() &&
+ Engine()->GetEditEngine().GetText()==String(EMPTYSTRING) )
+ {
+ mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), 0 );
+ }
+}
+
+void SwSidebarWin::ToggleInsMode()
+{
+ if (!mrView.GetWrtShell().IsRedlineOn())
+ {
+ //change outliner
+ mpOutlinerView->GetEditView().SetInsertMode(!mpOutlinerView->GetEditView().IsInsertMode());
+ //change documnet
+ mrView.GetWrtShell().ToggleInsMode();
+ //update statusbar
+ SfxBindings &rBnd = mrView.GetViewFrame()->GetBindings();
+ rBnd.Invalidate(SID_ATTR_INSERT);
+ rBnd.Update(SID_ATTR_INSERT);
+ }
+}
+
+void SwSidebarWin::ExecuteCommand(USHORT nSlot)
+{
+ mrMgr.AssureStdModeAtShell();
+
+ switch (nSlot)
+ {
+ case FN_POSTIT:
+ case FN_REPLY:
+ {
+ // if this note is empty, it will be deleted once losing the focus, so no reply, but only a new note
+ // will be created
+ if (Engine()->GetEditEngine().GetText() != String(EMPTYSTRING))
+ {
+ OutlinerParaObject* pPara = new OutlinerParaObject(*GetOutlinerView()->GetEditView().CreateTextObject());
+ mrMgr.RegisterAnswer(pPara);
+ }
+ if (mrMgr.HasActiveSidebarWin())
+ mrMgr.SetActiveSidebarWin(0);
+ SwitchToFieldPos();
+ mrView.GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
+ break;
+ }
+ case FN_DELETE_COMMENT:
+ case FN_DELETE_NOTE:
+
+ //Delete(); // do not kill the parent of our open popup menu
+ mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), 0 );
+ break;
+ case FN_DELETE_ALL_NOTES:
+ case FN_HIDE_ALL_NOTES:
+ // not possible as slot as this would require that "this" is the active postit
+ mrView.GetViewFrame()->GetBindings().Execute( nSlot, 0, 0, SFX_CALLMODE_ASYNCHRON );
+ break;
+ case FN_DELETE_NOTE_AUTHOR:
+ case FN_HIDE_NOTE_AUTHOR:
+ {
+ // not possible as slot as this would require that "this" is the active postit
+ SfxStringItem aItem( nSlot, GetAuthor() );
+ const SfxPoolItem* aItems[2];
+ aItems[0] = &aItem;
+ aItems[1] = 0;
+ mrView.GetViewFrame()->GetBindings().Execute( nSlot, aItems, 0, SFX_CALLMODE_ASYNCHRON );
+ }
+ default:
+ mrView.GetViewFrame()->GetBindings().Execute( nSlot );
+ break;
+ }
+}
+
+SwEditWin* SwSidebarWin::EditWin()
+{
+ return &mrView.GetEditWin();
+}
+
+long SwSidebarWin::GetPostItTextHeight()
+{
+ return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
+}
+
+void SwSidebarWin::SwitchToPostIt(USHORT aDirection)
+{
+ SwSidebarWin* pPostIt = mrMgr.GetNextPostIt(aDirection, this);
+ if (pPostIt)
+ pPostIt->GrabFocus();
+}
+
+IMPL_LINK( SwSidebarWin, WindowEventListener, VclSimpleEvent*, pEvent )
+{
+ VclWindowEvent* pWinEvent = dynamic_cast<VclWindowEvent*>(pEvent);
+ if ( pWinEvent )
+ {
+ if ( pWinEvent->GetId() == VCLEVENT_WINDOW_MOUSEMOVE )
+ {
+ MouseEvent* pMouseEvt = (MouseEvent*)pWinEvent->GetData();
+ if ( pMouseEvt->IsEnterWindow() )
+ {
+ mbMouseOver = true;
+ if ( !HasFocus() )
+ {
+ SetViewState(VS_VIEW);
+ Invalidate();
+ }
+ }
+ else if ( pMouseEvt->IsLeaveWindow())
+ {
+ if (IsPreview())
+ {
+ //doLazyDelete();
+ }
+ else
+ {
+ mbMouseOver = false;
+ if ( !HasFocus() )
+ {
+ SetViewState(VS_NORMAL);
+ Invalidate();
+ }
+ }
+ }
+ }
+ else if ( pWinEvent->GetId() == VCLEVENT_WINDOW_ACTIVATE &&
+ pWinEvent->GetWindow() == mpSidebarTxtControl )
+ {
+ const BOOL bLockView = mrView.GetWrtShell().IsViewLocked();
+ mrView.GetWrtShell().LockView( TRUE );
+
+ if ( !IsPreview() )
+ {
+ mrMgr.SetActiveSidebarWin( this );
+ }
+
+ mrView.GetWrtShell().LockView( bLockView );
+ mrMgr.MakeVisible( this );
+ }
+ else if ( pWinEvent->GetWindow() == mpSidebarTxtControl )
+ {
+ int i = 5;
+ ++i;
+ }
+ }
+ return sal_True;
+}
+
+void SwSidebarWin::Delete()
+{
+ if ( mrMgr.GetActiveSidebarWin() == this)
+ {
+ mrMgr.SetActiveSidebarWin(0);
+ // if the note is empty, the previous line will send a delete event, but we are already there
+ if (mnEventId)
+ {
+ Application::RemoveUserEvent( mnEventId );
+ mnEventId = 0;
+ }
+ }
+}
+
+IMPL_LINK(SwSidebarWin, ScrollHdl, ScrollBar*, pScroll)
+{
+ long nDiff = GetOutlinerView()->GetEditView().GetVisArea().Top() - pScroll->GetThumbPos();
+ GetOutlinerView()->Scroll( 0, nDiff );
+ return 0;
+}
+
+IMPL_LINK(SwSidebarWin, ModifyHdl, void*, pVoid)
+{
+ // no warnings, please
+ pVoid=0;
+ mrView.GetDocShell()->SetModified(sal_True);
+ return 0;
+}
+
+IMPL_LINK(SwSidebarWin, DeleteHdl, void*, pVoid)
+{
+ // no warnings, please
+ pVoid=0;
+ mnEventId = 0;
+ Delete();
+ return 0;
+}
+
+
+void SwSidebarWin::ResetAttributes()
+{
+ mpOutlinerView->RemoveAttribsKeepLanguages(TRUE);
+ mpOutliner->RemoveFields(TRUE);
+ mpOutlinerView->SetAttribs(DefaultItem());
+}
+
+sal_Int32 SwSidebarWin::GetScrollbarWidth()
+{
+ return mrView.GetWrtShell().GetViewOptions()->GetZoom() / 10;
+}
+
+sal_Int32 SwSidebarWin::GetMetaButtonAreaWidth()
+{
+ const Fraction& f( GetMapMode().GetScaleX() );
+ if (IsPreview())
+ return 3 * METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
+ else
+ return METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
+}
+
+sal_Int32 SwSidebarWin::GetMetaHeight()
+{
+ const Fraction& f( GetMapMode().GetScaleY() );
+ return POSTIT_META_HEIGHT * f.GetNumerator() / f.GetDenominator();
+}
+
+sal_Int32 SwSidebarWin::GetMinimumSizeWithMeta()
+{
+ return mrMgr.GetMinimumSizeWithMeta();
+}
+
+sal_Int32 SwSidebarWin::GetMinimumSizeWithoutMeta()
+{
+ const Fraction& f( GetMapMode().GetScaleY() );
+ return POSTIT_MINIMUMSIZE_WITHOUT_META * f.GetNumerator() / f.GetDenominator();
+}
+
+void SwSidebarWin::SetSpellChecking()
+{
+ const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
+ ULONG nCntrl = mpOutliner->GetControlWord();
+ if (pVOpt->IsOnlineSpell())
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ mpOutliner->SetControlWord(nCntrl);
+
+ mpOutliner->CompleteOnlineSpelling();
+ Invalidate();
+}
+
+void SwSidebarWin::SetViewState(ViewState bViewState)
+{
+ switch (bViewState)
+ {
+ case VS_EDIT:
+ {
+ if (mpAnchor)
+ {
+ mpAnchor->SetAnchorState(AS_ALL);
+ SwSidebarWin* pWin = GetTopReplyNote();
+ if (pWin)
+ pWin->Anchor()->SetAnchorState(AS_END);
+ mpAnchor->setLineSolid(true);
+ }
+ if (mpShadow)
+ mpShadow->SetShadowState(SS_EDIT);
+ break;
+ }
+ case VS_VIEW:
+ {
+ if (mpAnchor)
+ mpAnchor->setLineSolid(true);
+ if (mpShadow)
+ mpShadow->SetShadowState(SS_VIEW);
+ break;
+ }
+ case VS_NORMAL:
+ {
+ if (mpAnchor)
+ {
+ if (IsFollow())
+ {
+ // if there is no visible parent note, we want to see the complete anchor ??
+ //if (IsAnyStackParentVisible())
+ mpAnchor->SetAnchorState(AS_END);
+ SwSidebarWin* pTopWinSelf = GetTopReplyNote();
+ SwSidebarWin* pTopWinActive = mrMgr.HasActiveSidebarWin()
+ ? mrMgr.GetActiveSidebarWin()->GetTopReplyNote()
+ : 0;
+ if (pTopWinSelf && (pTopWinSelf!=pTopWinActive))
+ {
+ if (pTopWinSelf!=mrMgr.GetActiveSidebarWin())
+ pTopWinSelf->Anchor()->setLineSolid(false);
+ pTopWinSelf->Anchor()->SetAnchorState(AS_ALL);
+ }
+ }
+ mpAnchor->setLineSolid(false);
+ }
+ if (mpShadow)
+ mpShadow->SetShadowState(SS_NORMAL);
+ break;
+ }
+ }
+}
+
+SwSidebarWin* SwSidebarWin::GetTopReplyNote()
+{
+ SwSidebarWin* pTopNote = 0;
+ SwSidebarWin* pSidebarWin = IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, this) : 0;
+ while (pSidebarWin)
+ {
+ pTopNote = pSidebarWin;
+ pSidebarWin = pSidebarWin->IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, pSidebarWin) : 0;
+ }
+ return pTopNote;
+}
+
+void SwSidebarWin::SwitchToFieldPos()
+{
+ if ( mrMgr.GetActiveSidebarWin() == this )
+ mrMgr.SetActiveSidebarWin(0);
+ GotoPos();
+ sal_uInt32 aCount = MoveCaret();
+ if (aCount)
+ mrView.GetDocShell()->GetWrtShell()->SwCrsrShell::Right(aCount, 0, FALSE);
+ GrabFocusToDocument();
+}
+
+SvxLanguageItem SwSidebarWin::GetLanguage(void)
+{
+ return SvxLanguageItem(SwLangHelper::GetLanguage(mrView.GetWrtShell(),RES_CHRATR_LANGUAGE),RES_CHRATR_LANGUAGE);
+}
+
+void SwSidebarWin::SetChangeTracking( const SwPostItHelper::SwLayoutStatus aLayoutStatus,
+ const Color& aChangeColor )
+{
+ if ( (mLayoutStatus != aLayoutStatus) ||
+ (mChangeColor != aChangeColor) )
+ {
+ mLayoutStatus = aLayoutStatus;
+ mChangeColor = aChangeColor;
+ Invalidate();
+ }
+}
+
+bool SwSidebarWin::HasScrollbar() const
+{
+ return mpVScrollbar != 0;
+}
+
+bool SwSidebarWin::IsScrollbarVisible() const
+{
+ return HasScrollbar() && mpVScrollbar->IsVisible();
+}
+
+void SwSidebarWin::ChangeSidebarItem( SwSidebarItem& rSidebarItem )
+{
+ const bool bAnchorChanged = mpAnchorFrm != rSidebarItem.maLayoutInfo.mpAnchorFrm;
+ if ( bAnchorChanged )
+ {
+ mrMgr.DisconnectSidebarWinFromFrm( *(mpAnchorFrm), *this );
+ }
+
+ mrSidebarItem = rSidebarItem;
+ mpAnchorFrm = mrSidebarItem.maLayoutInfo.mpAnchorFrm;
+
+ if ( GetWindowPeer() )
+ {
+ SidebarWinAccessible* pAcc =
+ static_cast<SidebarWinAccessible*>( GetWindowPeer() );
+ ASSERT( dynamic_cast<SidebarWinAccessible*>( GetWindowPeer() ),
+ "<SwSidebarWin::ChangeSidebarItem(..)> - unexpected type of window peer -> crash possible!" );
+ pAcc->ChangeSidebarItem( mrSidebarItem );
+ }
+
+ if ( bAnchorChanged )
+ {
+ mrMgr.ConnectSidebarWinToFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm),
+ *(mrSidebarItem.GetFmtFld()),
+ *this );
+ }
+}
+
+css::uno::Reference< css::accessibility::XAccessible > SwSidebarWin::CreateAccessible()
+{
+ SidebarWinAccessible* pAcc( new SidebarWinAccessible( *this,
+ mrView.GetWrtShell(),
+ mrSidebarItem ) );
+ css::uno::Reference< css::awt::XWindowPeer > xWinPeer( pAcc );
+ SetWindowPeer( xWinPeer, pAcc );
+
+ css::uno::Reference< css::accessibility::XAccessible > xAcc( xWinPeer, css::uno::UNO_QUERY );
+ return xAcc;
+}
+
+} } // eof of namespace sw::sidebarwindows
+
+/********** SwRedComment**************/
+/*
+SwRedComment::SwRedComment( Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits,SwRedline* pRed)
+ : SwSidebarWin(pParent,nBits,aMgr,aBits),
+ pRedline(pRed)
+{
+}
+
+void SwRedComment::SetPopup()
+{
+ mpButtonPopup = new PopupMenu(SW_RES(MN_REDCOMMENT_BUTTON));
+ //mpButtonPopup->SetMenuFlags(MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES);
+}
+
+void SwRedComment::UpdateData()
+{
+ if ( Engine()->IsModified() )
+ {
+ // so we get a new layout of notes (Anchor position is still the same and we would otherwise not get one)
+ Mgr()->SetLayout();
+ // SetRedline is calling SetModified already
+ DocView()->GetWrtShell().SetRedlineComment(Engine()->GetEditEngine().GetText());
+ }
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+}
+
+void SwRedComment::SetPostItText()
+{
+ Engine()->SetModifyHdl( Link() );
+ Engine()->EnableUndo( FALSE );
+
+ Engine()->Clear();
+ View()->SetAttribs(DefaultItem());
+ View()->InsertText(pRedline->GetComment(),false);
+
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+ Engine()->EnableUndo( TRUE );
+ Engine()->SetModifyHdl( LINK( this, SwSidebarWin, ModifyHdl ) );
+ Invalidate();
+}
+
+void SwRedComment::DeactivatePostIt()
+{
+ SwSidebarWin::DeactivatePostIt();
+ // current Redline is still selected
+ DocView()->GetWrtShellPtr()->ClearMark();
+}
+
+void SwRedComment::ActivatePostIt()
+{
+ SwSidebarWin::ActivatePostIt();
+
+ // do we want the redline selected?
+ // otherwise, SwRedComment::ActivatePostIt() as well as SwRedComment::DeactivatePostIt()
+ // can be thrown out completly
+ DocView()->GetDocShell()->GetWrtShell()->GotoRedline(
+ DocView()->GetDocShell()->GetWrtShell()->FindRedlineOfData(pRedline->GetRedlineData()),true);
+}
+
+void SwRedComment::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if (mRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel())) && rMEvt.IsLeft())
+ {
+ ExecuteCommand( mpButtonPopup->Execute( this,Rectangle(LogicToPixel(mRectMetaButton.BottomLeft()),LogicToPixel(mRectMetaButton.BottomLeft())),POPUPMENU_EXECUTE_DOWN | POPUPMENU_NOMOUSEUPCLOSE) );
+ }
+}
+
+void SwRedComment::Delete()
+{
+ SwSidebarWin::Delete();
+ // we are not neccessarily on our redline, so let's move there
+ GotoPos();
+ DocView()->GetWrtShell().SetRedlineComment(EMPTYSTRING);
+ DocView()->GetWrtShell().ClearMark();
+ // so we get a new layout of notes (Anchor position is still the same and we would otherwise not get one)
+ Mgr()->SetLayout();
+ Mgr()->RemoveItem(pRedline);
+}
+
+void SwRedComment::GotoPos()
+{
+ DocView()->GetDocShell()->GetWrtShell()->GotoRedline(
+ DocView()->GetDocShell()->GetWrtShell()->FindRedlineOfData(pRedline->GetRedlineData()));
+}
+
+String SwRedComment::GetAuthor()
+{
+ return pRedline->GetAuthorString();
+}
+
+Date SwRedComment::GetDate()
+{
+ return pRedline->GetTimeStamp().GetDate();
+}
+
+Time SwRedComment::GetTime()
+{
+ return pRedline->GetTimeStamp().GetTime();
+}
+
+bool SwRedComment::IsProtected()
+{
+ return SwSidebarWin::IsProtected() || pRedline->Start()->nNode.GetNode().GetTxtNode()->IsInProtectSect();
+}
+*/
diff --git a/sw/source/ui/docvw/SidebarWinAcc.cxx b/sw/source/ui/docvw/SidebarWinAcc.cxx
new file mode 100644
index 000000000000..214913963dcb
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarWinAcc.cxx
@@ -0,0 +1,162 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <SidebarWinAcc.hxx>
+
+#include <SidebarWin.hxx>
+#include <viewsh.hxx>
+#include <accmap.hxx>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace sidebarwindows {
+
+// =============================================================================
+// declaration and implementation of accessible context for <SidebarWinAccessible> instance
+// =============================================================================
+class SidebarWinAccessibleContext : public VCLXAccessibleComponent
+{
+ public:
+ explicit SidebarWinAccessibleContext( SwSidebarWin& rSidebarWin,
+ ViewShell& rViewShell,
+ const SwFrm* pAnchorFrm )
+ : VCLXAccessibleComponent( rSidebarWin.GetWindowPeer() )
+ , mrViewShell( rViewShell )
+ , mpAnchorFrm( pAnchorFrm )
+ , maMutex()
+ {
+ rSidebarWin.SetAccessibleRole( css::accessibility::AccessibleRole::COMMENT );
+ }
+
+ virtual ~SidebarWinAccessibleContext()
+ {}
+
+ void ChangeAnchor( const SwFrm* pAnchorFrm )
+ {
+ vos::OGuard aGuard(maMutex);
+
+ mpAnchorFrm = pAnchorFrm;
+ }
+
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
+ getAccessibleParent() throw (css::uno::RuntimeException)
+ {
+ vos::OGuard aGuard(maMutex);
+
+ css::uno::Reference< css::accessibility::XAccessible > xAccParent;
+
+ if ( mpAnchorFrm &&
+ mrViewShell.GetAccessibleMap() )
+ {
+ xAccParent = mrViewShell.GetAccessibleMap()->GetContext( mpAnchorFrm, sal_False );
+ }
+
+ return xAccParent;
+ }
+
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (css::uno::RuntimeException)
+ {
+ vos::OGuard aGuard(maMutex);
+
+ sal_Int32 nIndex( -1 );
+
+ if ( mpAnchorFrm && GetWindow() &&
+ mrViewShell.GetAccessibleMap() )
+ {
+ nIndex = mrViewShell.GetAccessibleMap()->GetChildIndex( *mpAnchorFrm,
+ *GetWindow() );
+ }
+
+ return nIndex;
+ }
+
+ private:
+ ViewShell& mrViewShell;
+ const SwFrm* mpAnchorFrm;
+
+ ::vos::OMutex maMutex;
+};
+
+// =============================================================================
+// implementaion of accessible for <SwSidebarWin> instance
+// =============================================================================
+SidebarWinAccessible::SidebarWinAccessible( SwSidebarWin& rSidebarWin,
+ ViewShell& rViewShell,
+ const SwSidebarItem& rSidebarItem )
+ : VCLXWindow()
+ , mrSidebarWin( rSidebarWin )
+ , mrViewShell( rViewShell )
+ , mpAnchorFrm( rSidebarItem.maLayoutInfo.mpAnchorFrm )
+ , bAccContextCreated( false )
+{
+ SetWindow( &mrSidebarWin );
+}
+
+SidebarWinAccessible::~SidebarWinAccessible()
+{
+}
+
+void SidebarWinAccessible::ChangeSidebarItem( const SwSidebarItem& rSidebarItem )
+{
+ if ( bAccContextCreated )
+ {
+ css::uno::Reference< css::accessibility::XAccessibleContext > xAcc
+ = getAccessibleContext();
+ if ( xAcc.is() )
+ {
+ SidebarWinAccessibleContext* pAccContext =
+ dynamic_cast<SidebarWinAccessibleContext*>(xAcc.get());
+ if ( pAccContext )
+ {
+ pAccContext->ChangeAnchor( rSidebarItem.maLayoutInfo.mpAnchorFrm );
+ }
+ }
+ }
+}
+
+css::uno::Reference< css::accessibility::XAccessibleContext > SidebarWinAccessible::CreateAccessibleContext()
+{
+ SidebarWinAccessibleContext* pAccContext =
+ new SidebarWinAccessibleContext( mrSidebarWin,
+ mrViewShell,
+ mpAnchorFrm );
+ css::uno::Reference< css::accessibility::XAccessibleContext > xAcc( pAccContext );
+ bAccContextCreated = true;
+ return xAcc;
+}
+
+} } // end of namespace sw::sidebarwindows
+
diff --git a/sw/source/ui/docvw/SidebarWinAcc.hxx b/sw/source/ui/docvw/SidebarWinAcc.hxx
new file mode 100644
index 000000000000..0abe1acbfaf5
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarWinAcc.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SIDEBARWINACC_HXX
+#define _SIDEBARWINACC_HXX
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+class ViewShell;
+class SwSidebarItem;
+class SwFrm;
+
+namespace sw { namespace sidebarwindows {
+
+class SwSidebarWin;
+
+class SidebarWinAccessible : public VCLXWindow
+{
+ public:
+ explicit SidebarWinAccessible( SwSidebarWin& rSidebarWin,
+ ViewShell& rViewShell,
+ const SwSidebarItem& rSidebarItem );
+ virtual ~SidebarWinAccessible();
+
+ virtual com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessibleContext >
+ CreateAccessibleContext();
+
+ void ChangeSidebarItem( const SwSidebarItem& rSidebarItem );
+
+ private:
+ SwSidebarWin& mrSidebarWin;
+ ViewShell& mrViewShell;
+ const SwFrm* mpAnchorFrm;
+ bool bAccContextCreated;
+};
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/docvw/access.src b/sw/source/ui/docvw/access.src
index 17f06e8a0037..42081d3ab7e7 100644
--- a/sw/source/ui/docvw/access.src
+++ b/sw/source/ui/docvw/access.src
@@ -83,4 +83,20 @@ String STR_ACCESS_PAGE_DESC
{
Text [ en-US ] = "Page: $(ARG1)";
};
+String STR_ACCESS_ANNOTATION_AUTHOR_NAME
+{
+ Text [ en-US ] = "Author";
+};
+String STR_ACCESS_ANNOTATION_DATE_NAME
+{
+ Text [ en-US ] = "Date";
+};
+String STR_ACCESS_ANNOTATION_BUTTON_NAME
+{
+ Text [ en-US ] = "Actions";
+};
+String STR_ACCESS_ANNOTATION_BUTTON_DESC
+{
+ Text [ en-US ] = "Activate this button to open a list of actions which can be performed on this comment and other comments";
+};
diff --git a/sw/source/ui/docvw/annotation.hrc b/sw/source/ui/docvw/annotation.hrc
new file mode 100644
index 000000000000..e43a90342409
--- /dev/null
+++ b/sw/source/ui/docvw/annotation.hrc
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ANNOTATION_HRC
+#define _ANNOTATION_HRC
+
+#include "rcid.hrc"
+
+#define STR_POSTIT_TODAY (RC_ANNOTATION_BEGIN + 1)
+#define STR_POSTIT_YESTERDAY (RC_ANNOTATION_BEGIN + 2)
+
+#define STR_DELETE_ALL_NOTES (RC_ANNOTATION_BEGIN + 3)
+#define STR_DELETE_AUTHOR_NOTES (RC_ANNOTATION_BEGIN + 4)
+
+#define STR_NODATE (RC_ANNOTATION_BEGIN + 5)
+#define STR_NOAUTHOR (RC_ANNOTATION_BEGIN + 6)
+
+#define STR_REPLY (RC_ANNOTATION_BEGIN + 7)
+
+
+#define ANNOTATION_ACT_END STR_REPLY
+#if ANNOTATION_ACT_END > RC_ANNOTATION_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+
+#endif
diff --git a/sw/source/ui/docvw/annotation.src b/sw/source/ui/docvw/annotation.src
new file mode 100644
index 000000000000..8dcda9c25b8c
--- /dev/null
+++ b/sw/source/ui/docvw/annotation.src
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "annotation.hrc"
+#include "cmdid.h"
+
+String STR_POSTIT_TODAY
+{
+ Text [ en-US ] = "Today," ;
+};
+
+String STR_POSTIT_YESTERDAY
+{
+ Text [ en-US ] = "Yesterday," ;
+};
+
+String STR_DELETE_ALL_NOTES
+{
+ Text [ en-US ] = "All Comments" ;
+};
+
+String STR_DELETE_AUTHOR_NOTES
+{
+ Text [ en-US ] = "Comments by " ;
+};
+
+String STR_NODATE
+{
+ Text [ en-US ] = "(no date)" ;
+};
+
+String STR_NOAUTHOR
+{
+ Text [ en-US ] = "(no author)" ;
+};
+
+String STR_REPLY
+{
+ Text [ en-US ] = "Reply to $1" ;
+};
+
diff --git a/sw/source/ui/docvw/docvw.hrc b/sw/source/ui/docvw/docvw.hrc
index d0a696c4dd99..c0f15291795b 100644
--- a/sw/source/ui/docvw/docvw.hrc
+++ b/sw/source/ui/docvw/docvw.hrc
@@ -34,7 +34,7 @@
#define MN_READONLY_OPENURL (RC_DOCVW_BEGIN + 2)
#define MN_READONLY_OPENURLNEW (RC_DOCVW_BEGIN + 3)
#define MN_READONLY_EDITDOC (RC_DOCVW_BEGIN + 4)
-#define MN_READONLY_BROWSE_STOP (RC_DOCVW_BEGIN + 5)
+ // FREE, formerly known as MN_READONLY_BROWSE_STOP
#define MN_READONLY_BROWSE_BACKWARD (RC_DOCVW_BEGIN + 6)
#define MN_READONLY_BROWSE_FORWARD (RC_DOCVW_BEGIN + 7)
#define MN_READONLY_SELECTION_MODE (RC_DOCVW_BEGIN + 8)
@@ -81,17 +81,6 @@
#define STR_SMARTTAG_CLICK (RC_DOCVW_BEGIN + 21)
-#define STR_POSTIT_TODAY (RC_DOCVW_BEGIN + 22)
-#define STR_POSTIT_YESTERDAY (RC_DOCVW_BEGIN + 23)
-
-#define STR_DELETE_ALL_NOTES (RC_DOCVW_BEGIN + 24)
-#define STR_DELETE_AUTHOR_NOTES (RC_DOCVW_BEGIN + 25)
-
-#define STR_NODATE (RC_DOCVW_BEGIN + 26)
-#define STR_NOAUTHOR (RC_DOCVW_BEGIN + 27)
-
-#define STR_REPLY (RC_DOCVW_BEGIN + 28)
-
#define MSG_READONLY_CONTENT (RC_DOCVW_BEGIN + 1)
#define DOCVW_ACT_END STR_SMARTTAG_CLICK
diff --git a/sw/source/ui/docvw/docvw.src b/sw/source/ui/docvw/docvw.src
index aa9c8de1176c..dcd0f98103f4 100644
--- a/sw/source/ui/docvw/docvw.src
+++ b/sw/source/ui/docvw/docvw.src
@@ -78,12 +78,6 @@ Menu MN_READONLY_POPUP
SEPARATOR
MenuItem
{
- Identifier = MN_READONLY_BROWSE_STOP ;
- HelpID = SID_BROWSE_STOP ;
- Text [ en-US ] = "~Stop" ;
- };
- MenuItem
- {
Identifier = MN_READONLY_BROWSE_BACKWARD ;
HelpID = SID_BROWSE_BACKWARD ;
Text [ en-US ] = "Backwards" ;
@@ -300,38 +294,3 @@ String STR_SMARTTAG_CLICK
Text [ en-US ] = "%s-click to open Smart Tag menu" ;
};
-String STR_POSTIT_TODAY
-{
- Text [ en-US ] = "Today," ;
-};
-
-String STR_POSTIT_YESTERDAY
-{
- Text [ en-US ] = "Yesterday," ;
-};
-
-String STR_DELETE_ALL_NOTES
-{
- Text [ en-US ] = "All Comments" ;
-};
-
-String STR_DELETE_AUTHOR_NOTES
-{
- Text [ en-US ] = "Comments by " ;
-};
-
-String STR_NODATE
-{
- Text [ en-US ] = "(no date)" ;
-};
-
-String STR_NOAUTHOR
-{
- Text [ en-US ] = "(no author)" ;
-};
-
-String STR_REPLY
-{
- Text [ en-US ] = "Reply to $1" ;
-};
-
diff --git a/sw/source/ui/docvw/edtdd.cxx b/sw/source/ui/docvw/edtdd.cxx
index 94e131b06407..8e11e5117c27 100644
--- a/sw/source/ui/docvw/edtdd.cxx
+++ b/sw/source/ui/docvw/edtdd.cxx
@@ -515,7 +515,7 @@ IMPL_LINK( SwEditWin, DDHandler, Timer *, EMPTYARG )
ReleaseMouse();
bFrmDrag = FALSE;
- if ( rView.GetViewFrame() && rView.GetViewFrame()->GetFrame() )
+ if ( rView.GetViewFrame() )
{
bExecuteDrag = TRUE;
StartExecuteDrag();
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 6fcc3701aae1..e2e59e17831e 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -139,8 +139,7 @@
#include <doc.hxx>
#include <xmloff/odffields.hxx>
-#include "PostItMgr.hxx"
-#include "postit.hxx"
+#include <PostItMgr.hxx>
//JP 11.10.2001: enable test code for bug fix 91313
#if defined(DBG_UTIL) && (OSL_DEBUG_LEVEL > 1)
@@ -1342,8 +1341,8 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
}
aKeyEvent = KeyEvent( rKEvt.GetCharCode(),
- KeyCode( nKey, rKEvt.GetKeyCode().GetModifier() ),
- rKEvt.GetRepeat() );
+ KeyCode( nKey, rKEvt.GetKeyCode().GetModifier() ),
+ rKEvt.GetRepeat() );
}
}
@@ -2262,7 +2261,8 @@ KEYINPUT_CHECKTABLE_INSDEL:
BOOL bIsAutoCorrectChar = SvxAutoCorrect::IsAutoCorrectChar( aCh );
- if( !aKeyEvent.GetRepeat() && pACorr && bIsAutoCorrectChar &&
+ BOOL bRunNext = pACorr->HasRunNext();
+ if( !aKeyEvent.GetRepeat() && pACorr && ( bIsAutoCorrectChar || bRunNext ) &&
pACfg->IsAutoFmtByInput() &&
(( pACorr->IsAutoCorrFlag( ChgWeightUnderl ) &&
( '*' == aCh || '_' == aCh ) ) ||
@@ -2274,14 +2274,13 @@ KEYINPUT_CHECKTABLE_INSDEL:
if( '\"' != aCh && '\'' != aCh ) // nur bei "*_" rufen!
rSh.UpdateAttr();
}
- else if( !aKeyEvent.GetRepeat() && pACorr && bIsAutoCorrectChar &&
+ else if( !aKeyEvent.GetRepeat() && pACorr && ( bIsAutoCorrectChar || bRunNext ) &&
pACfg->IsAutoFmtByInput() &&
pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd |
- ChgOrdinalNumber |
+ ChgOrdinalNumber | AddNonBrkSpace |
ChgToEnEmDash | SetINetAttr |
Autocorrect ) &&
- '\"' != aCh && '\'' != aCh && '*' != aCh && '_' != aCh &&
- !bIsNormalChar
+ '\"' != aCh && '\'' != aCh && '*' != aCh && '_' != aCh
)
{
FlushInBuffer();
@@ -2605,7 +2604,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
if (rView.GetPostItMgr()->IsHit(rMEvt.GetPosPixel()))
return;
- rView.GetPostItMgr()->SetActivePostIt(0);
+ rView.GetPostItMgr()->SetActiveSidebarWin(0);
GrabFocus();
@@ -3364,11 +3363,16 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
bNoInterrupt = bTmpNoInterrupt;
}
- if( !bOverURLGrf && !bOnlyText )
+ if ( !bOverURLGrf && !bOnlyText )
{
const int nSelType = rSh.GetSelectionType();
- if( nSelType == nsSelectionType::SEL_OLE ||
- nSelType == nsSelectionType::SEL_GRF )
+ // --> OD 2009-12-30 #i89920#
+ // Check in general, if an object is selectable at given position.
+ // Thus, also text fly frames in background become selectable via Ctrl-Click.
+ if ( nSelType & nsSelectionType::SEL_OLE ||
+ nSelType & nsSelectionType::SEL_GRF ||
+ rSh.IsObjSelectable( aDocPos ) )
+ // <--
{
MV_KONTEXT( &rSh );
if( !rSh.IsFrmSelected() )
@@ -4696,8 +4700,10 @@ BOOL SwEditWin::IsDrawSelMode()
void SwEditWin::GetFocus()
{
- if (rView.GetPostItMgr()->GetActivePostIt())
- rView.GetPostItMgr()->GetActivePostIt()->GrabFocus();
+ if ( rView.GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ rView.GetPostItMgr()->GrabFocusOnActiveSidebarWin();
+ }
else
{
rView.GotFocus();
@@ -4731,7 +4737,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt )
{
SwWrtShell &rSh = rView.GetWrtShell();
- if ( !rView.GetViewFrame() || !rView.GetViewFrame()->GetFrame() )
+ if ( !rView.GetViewFrame() )
{
//Wenn der ViewFrame in Kuerze stirbt kein Popup mehr!
Window::Command(rCEvt);
diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx
index d605ef993457..763504c75db6 100644
--- a/sw/source/ui/docvw/edtwin2.cxx
+++ b/sw/source/ui/docvw/edtwin2.cxx
@@ -87,7 +87,6 @@
#include <utlui.hrc>
#endif
-#include <postit.hxx>
#include <PostItMgr.hxx>
#include <fmtfld.hxx>
diff --git a/sw/source/ui/docvw/frmsidebarwincontainer.cxx b/sw/source/ui/docvw/frmsidebarwincontainer.cxx
new file mode 100644
index 000000000000..b5e406dcf69b
--- /dev/null
+++ b/sw/source/ui/docvw/frmsidebarwincontainer.cxx
@@ -0,0 +1,216 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <frmsidebarwincontainer.hxx>
+
+#include <map>
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <SidebarWin.hxx>
+
+namespace {
+ struct SidebarWinKey
+ {
+ const xub_StrLen mnIndex;
+
+ explicit SidebarWinKey( const xub_StrLen nIndex )
+ : mnIndex( nIndex )
+ {}
+
+ bool operator < ( const SidebarWinKey& rSidebarWinKey ) const
+ {
+ return mnIndex < rSidebarWinKey.mnIndex;
+ }
+ };
+
+ struct SidebarWinOrder
+ {
+ sal_Bool operator()( const SidebarWinKey& rSidebarWinKeyA,
+ const SidebarWinKey& rSidebarWinKeyB ) const
+ {
+ return rSidebarWinKeyA < rSidebarWinKeyB;
+ }
+ };
+
+ typedef ::std::map < SidebarWinKey, sw::sidebarwindows::SwSidebarWin*, SidebarWinOrder > SidebarWinContainer;
+
+ struct FrmKey
+ {
+ const SwFrm* mpFrm;
+
+ explicit FrmKey( const SwFrm* pFrm )
+ : mpFrm( pFrm )
+ {}
+
+ bool operator < ( const FrmKey& rFrmKey ) const
+ {
+ return mpFrm < rFrmKey.mpFrm;
+ }
+ };
+
+ struct FrmOrder
+ {
+ sal_Bool operator()( const FrmKey& rFrmKeyA,
+ const FrmKey& rFrmKeyB ) const
+ {
+ return rFrmKeyA < rFrmKeyB;
+ }
+ };
+
+ typedef ::std::map < FrmKey, SidebarWinContainer, FrmOrder > _FrmSidebarWinContainer;
+}
+
+namespace sw { namespace sidebarwindows {
+
+class FrmSidebarWinContainer : public _FrmSidebarWinContainer
+{
+};
+
+SwFrmSidebarWinContainer::SwFrmSidebarWinContainer()
+ : mpFrmSidebarWinContainer( new FrmSidebarWinContainer() )
+{}
+
+SwFrmSidebarWinContainer::~SwFrmSidebarWinContainer()
+{
+ mpFrmSidebarWinContainer->clear();
+ delete mpFrmSidebarWinContainer;
+}
+
+bool SwFrmSidebarWinContainer::insert( const SwFrm& rFrm,
+ const SwFmtFld& rFmtFld,
+ SwSidebarWin& rSidebarWin )
+{
+ bool bInserted( false );
+
+ FrmKey aFrmKey( &rFrm );
+ SidebarWinContainer& rSidebarWinContainer = (*mpFrmSidebarWinContainer)[ aFrmKey ];
+
+ SidebarWinKey aSidebarWinKey( *(rFmtFld.GetTxtFld()->GetStart()) );
+ if ( rSidebarWinContainer.empty() ||
+ rSidebarWinContainer.find( aSidebarWinKey) == rSidebarWinContainer.end() )
+ {
+ rSidebarWinContainer[ aSidebarWinKey ] = &rSidebarWin;
+ bInserted = true;
+ }
+
+ return bInserted;
+}
+
+bool SwFrmSidebarWinContainer::remove( const SwFrm& rFrm,
+ const SwSidebarWin& rSidebarWin )
+{
+ bool bRemoved( false );
+
+ FrmKey aFrmKey( &rFrm );
+ FrmSidebarWinContainer::iterator aFrmIter = mpFrmSidebarWinContainer->find( aFrmKey );
+ if ( aFrmIter != mpFrmSidebarWinContainer->end() )
+ {
+ SidebarWinContainer& rSidebarWinContainer = (*aFrmIter).second;
+ for ( SidebarWinContainer::iterator aIter = rSidebarWinContainer.begin();
+ aIter != rSidebarWinContainer.end();
+ ++aIter )
+ {
+ if ( (*aIter).second == &rSidebarWin )
+ {
+ rSidebarWinContainer.erase( aIter );
+ bRemoved = true;
+ break;
+ }
+ }
+ }
+
+ return bRemoved;
+}
+
+bool SwFrmSidebarWinContainer::empty( const SwFrm& rFrm )
+{
+ bool bEmpty( true );
+
+ FrmKey aFrmKey( &rFrm );
+ FrmSidebarWinContainer::iterator aFrmIter = mpFrmSidebarWinContainer->find( aFrmKey );
+ if ( aFrmIter != mpFrmSidebarWinContainer->end() )
+ {
+ bEmpty = (*aFrmIter).second.empty();
+ }
+
+ return bEmpty;
+}
+
+SwSidebarWin* SwFrmSidebarWinContainer::get( const SwFrm& rFrm,
+ const sal_Int32 nIndex )
+{
+ SwSidebarWin* pRet( 0 );
+
+ FrmKey aFrmKey( &rFrm );
+ FrmSidebarWinContainer::iterator aFrmIter = mpFrmSidebarWinContainer->find( aFrmKey );
+ if ( aFrmIter != mpFrmSidebarWinContainer->end() )
+ {
+ SidebarWinContainer& rSidebarWinContainer = (*aFrmIter).second;
+ sal_Int32 nCounter( nIndex );
+ for ( SidebarWinContainer::iterator aIter = rSidebarWinContainer.begin();
+ nCounter >= 0 && aIter != rSidebarWinContainer.end();
+ ++aIter )
+ {
+ if ( nCounter == 0 )
+ {
+ pRet = (*aIter).second;
+ break;
+ }
+
+ --nCounter;
+ }
+ }
+
+ return pRet;
+}
+
+void SwFrmSidebarWinContainer::getAll( const SwFrm& rFrm,
+ std::vector< Window* >* pSidebarWins )
+{
+ pSidebarWins->clear();
+
+ FrmKey aFrmKey( &rFrm );
+ FrmSidebarWinContainer::iterator aFrmIter = mpFrmSidebarWinContainer->find( aFrmKey );
+ if ( aFrmIter != mpFrmSidebarWinContainer->end() )
+ {
+ SidebarWinContainer& rSidebarWinContainer = (*aFrmIter).second;
+ for ( SidebarWinContainer::iterator aIter = rSidebarWinContainer.begin();
+ aIter != rSidebarWinContainer.end();
+ ++aIter )
+ {
+ pSidebarWins->push_back( (*aIter).second );
+ }
+ }
+}
+
+} } // eof of namespace sw::sidebarwindows::
diff --git a/sw/source/ui/docvw/frmsidebarwincontainer.hxx b/sw/source/ui/docvw/frmsidebarwincontainer.hxx
new file mode 100644
index 000000000000..1583f36a0bb6
--- /dev/null
+++ b/sw/source/ui/docvw/frmsidebarwincontainer.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FRMSIDEBARWINCONTAINER_HXX
+#define _FRMSIDEBARWINCONTAINER_HXX
+
+#include <sal/types.h>
+#include <vector>
+
+class SwFrm;
+class SwFmtFld;
+class Window;
+
+namespace sw { namespace sidebarwindows {
+
+class SwSidebarWin;
+class FrmSidebarWinContainer;
+
+class SwFrmSidebarWinContainer
+{
+ public:
+ SwFrmSidebarWinContainer();
+ ~SwFrmSidebarWinContainer();
+
+ bool insert( const SwFrm& rFrm,
+ const SwFmtFld& rFmtFld,
+ SwSidebarWin& rSidebarWin );
+
+ bool remove( const SwFrm& rFrm,
+ const SwSidebarWin& rSidebarWin );
+
+ bool empty( const SwFrm& rFrm );
+
+ SwSidebarWin* get( const SwFrm& rFrm,
+ const sal_Int32 nIndex );
+
+ void getAll( const SwFrm& rFrm,
+ std::vector< Window* >* pSidebarWins );
+
+ private:
+ FrmSidebarWinContainer* mpFrmSidebarWinContainer;
+};
+
+} } // eof of namespace sw::sidebarwindows::
+
+#endif
+
diff --git a/sw/source/ui/docvw/makefile.mk b/sw/source/ui/docvw/makefile.mk
index c3644c83f267..a2914b2f86b7 100644
--- a/sw/source/ui/docvw/makefile.mk
+++ b/sw/source/ui/docvw/makefile.mk
@@ -42,7 +42,8 @@ ENABLE_EXCEPTIONS=TRUE
SRS1NAME=$(TARGET)
SRC1FILES = \
access.src \
- docvw.src
+ docvw.src \
+ annotation.src
SLOFILES = \
$(SLO)$/edtdd.obj \
@@ -51,8 +52,16 @@ SLOFILES = \
$(SLO)$/edtwin3.obj \
$(SLO)$/romenu.obj \
$(SLO)$/srcedtw.obj \
- $(SLO)$/postit.obj \
- $(SLO)$/PostItMgr.obj
+ $(SLO)$/PostItMgr.obj \
+ $(SLO)$/frmsidebarwincontainer.obj \
+ $(SLO)$/AnchorOverlayObject.obj \
+ $(SLO)$/ShadowOverlayObject.obj \
+ $(SLO)$/SidebarWin.obj \
+ $(SLO)$/SidebarWinAcc.obj \
+ $(SLO)$/AnnotationWin.obj \
+ $(SLO)$/AnnotationMenuButton.obj \
+ $(SLO)$/SidebarTxtControl.obj \
+ $(SLO)$/SidebarTxtControlAcc.obj
# --- Tagets -------------------------------------------------------
diff --git a/sw/source/ui/docvw/postit.cxx b/sw/source/ui/docvw/postit.cxx
deleted file mode 100644
index b5a8ea2edba8..000000000000
--- a/sw/source/ui/docvw/postit.cxx
+++ /dev/null
@@ -1,2483 +0,0 @@
-/************************************************************************* *
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include "precompiled_sw.hxx"
-#include <postit.hxx>
-#include <PostItMgr.hxx>
-
-#include <popup.hrc>
-#include <docvw.hrc>
-#include <app.hrc>
-
-#include <hintids.hxx>
-#include "viewopt.hxx"
-#include "cmdid.h"
-
-#include <tools/poly.hxx> // Polygon
-
-#include <editeng/postitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/eeitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/bulitem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/shdditem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/flditem.hxx>
-#include <editeng/frmdir.hxx>
-#include <editeng/frmdiritem.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/adjitem.hxx>
-#include <editeng/editview.hxx>
-#include <svx/svdview.hxx>
-#include <svx/sdrpaintwindow.hxx>
-#include <svx/sdr/overlay/overlaymanager.hxx>
-#include <editeng/editstat.hxx> //EditEngine flags
-#include <editeng/outliner.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editobj.hxx>
-#include <editeng/unolingu.hxx>
-
-#include <svtools/langtab.hxx>
-#include <svl/slstitm.hxx>
-#include <unotools/securityoptions.hxx>
-#include <unotools/useroptions.hxx>
-#include <svl/languageoptions.hxx>
-#include <svl/zforlist.hxx>
-#include <svtools/svmedit.hxx>
-
-#include <linguistic/lngprops.hxx>
-
-#include <sfx2/request.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/mnumgr.hxx>
-
-#include <vcl/vclenum.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/help.hxx>
-#include <vcl/scrbar.hxx>
-#include <vcl/button.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/gradient.hxx>
-#include <vcl/salbtype.hxx> // FRound
-#include <vcl/msgbox.hxx>
-
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <basegfx/tuple/b2dtuple.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-
-#include <swrect.hxx>
-#include <docufld.hxx> // SwPostItField
-#include <edtwin.hxx>
-#include <view.hxx>
-#include <viewsh.hxx>
-#include <docsh.hxx>
-#include <shellres.hxx>
-#include <fmtfld.hxx>
-#include <wrtsh.hxx>
-#include <textsh.hxx>
-#include <doc.hxx>
-#include <txtfld.hxx>
-#include <redline.hxx>
-#include <uitool.hxx>
-#include <SwUndoField.hxx>
-#include <editsh.hxx>
-#include <swmodule.hxx>
-#include <node.hxx>
-#include <ndtxt.hxx>
-#include <langhelper.hxx>
-
-#include <sw_primitivetypes2d.hxx>
-#include <drawinglayer/primitive2d/primitivetools2d.hxx>
-#include <drawinglayer/attribute/fillattribute.hxx>
-#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
-#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
-#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
-#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
-
-using namespace ::com::sun::star;
-
-#define METABUTTON_WIDTH 16
-#define METABUTTON_HEIGHT 18
-#define METABUTTON_AREA_WIDTH 30
-#define POSTIT_META_HEIGHT (sal_Int32) 30
-#define POSTIT_MINIMUMSIZE_WITHOUT_META 50
-
-#define POSTIT_SHADOW_BRIGHT Color(180,180,180)
-#define POSTIT_SHADOW_DARK Color(83,83,83)
-
-#define LINEBREAK rtl::OUString::createFromAscii("\n")
-#define EMPTYSTRING rtl::OUString::createFromAscii("")
-
-TYPEINIT0(SwMarginWin);
-TYPEINIT1(SwPostIt,SwMarginWin);
-//TYPEINIT1(SwRedComment,SwMarginWin);
-
-Color ColorFromAlphaColor(UINT8 aTransparency, Color &aFront, Color &aBack )
-{
- return Color((UINT8)(aFront.GetRed() * aTransparency/(double)255 + aBack.GetRed() * (1-aTransparency/(double)255)),
- (UINT8)(aFront.GetGreen() * aTransparency/(double)255 + aBack.GetGreen() * (1-aTransparency/(double)255)),
- (UINT8)(aFront.GetBlue() * aTransparency/(double)255 + aBack.GetBlue() * (1-aTransparency/(double)255)));
-}
-
-/************ PostItTxt **************************************/
-PostItTxt::PostItTxt(Window* pParent, WinBits nBits) : Window(pParent, nBits), mpOutlinerView(0),mMouseOver(false),mbShowPopup(FALSE)
-{
- SetHelpId(26276);
- AddEventListener( LINK( this, PostItTxt, WindowEventListener ) );
- mpMarginWin = static_cast<SwMarginWin*>(GetParent());
-}
-
-PostItTxt::~PostItTxt()
-{
- RemoveEventListener( LINK( this, PostItTxt, WindowEventListener ) );
-}
-
-void PostItTxt::GetFocus()
-{
- BOOL bLockView = mpMarginWin->DocView()->GetWrtShell().IsViewLocked();
- mpMarginWin->DocView()->GetWrtShell().LockView( TRUE );
-
- if(mpMarginWin && !mpMarginWin->IsPreview())
- mpMarginWin->Mgr()->SetActivePostIt(mpMarginWin);
- Window::GetFocus();
- if (!mMouseOver)
- Invalidate();
-
- mpMarginWin->DocView()->GetWrtShell().LockView( bLockView );
- mpMarginWin->Mgr()->MakeVisible(mpMarginWin);
-}
-
-void PostItTxt::LoseFocus()
-{
- // write the visible text back into the SwField
- if ( mpMarginWin )
- mpMarginWin->UpdateData();
-
- Window::LoseFocus();
- if (!mMouseOver)
- Invalidate();
-}
-
-void PostItTxt::RequestHelp(const HelpEvent &rEvt)
-{
- USHORT nResId = 0;
- switch( mpMarginWin->GetStatus() )
- {
- case SwPostItHelper::INSERTED: nResId = STR_REDLINE_INSERT; break;
- case SwPostItHelper::DELETED: nResId = STR_REDLINE_DELETE; break;
- default: nResId = 0;
- }
-
- SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE );
- if ( nResId && mpMarginWin->DocView()->GetWrtShell().GetContentAtPos( mpMarginWin->GetAnkorRect().Pos(), aCntntAtPos ) )
- {
- String sTxt;
- sTxt = SW_RESSTR( nResId );
- sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM(": " ));
- sTxt += aCntntAtPos.aFnd.pRedl->GetAuthorString();
- sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " ));
- sTxt += GetAppLangDateTimeString( aCntntAtPos.aFnd.pRedl->GetTimeStamp() );
- Help::ShowQuickHelp( this,PixelToLogic(Rectangle(rEvt.GetMousePosPixel(),Size(50,10))),sTxt);
- }
-}
-
-void PostItTxt::Paint( const Rectangle& rRect)
-{
- if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- {
- if (mMouseOver || HasFocus())
- DrawGradient(Rectangle(Point(0,0),PixelToLogic(GetSizePixel())),
- Gradient(GRADIENT_LINEAR,mpMarginWin->ColorDark(),mpMarginWin->ColorDark()));
- else
- DrawGradient(Rectangle(Point(0,0),PixelToLogic(GetSizePixel())),
- Gradient(GRADIENT_LINEAR,mpMarginWin->ColorLight(),mpMarginWin->ColorDark()));
- }
-
- mpOutlinerView->Paint( rRect );
-
- if (mpMarginWin->GetStatus()==SwPostItHelper::DELETED)
- {
- SetLineColor(static_cast<SwPostIt*>(mpMarginWin)->GetChangeColor());
- DrawLine(PixelToLogic(GetPosPixel()),PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width(),GetSizePixel().Height())));
- DrawLine(PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width(),0)),PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height())));
- }
-}
-
-void PostItTxt::KeyInput( const KeyEvent& rKeyEvt )
-{
- const KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
- USHORT nKey = rKeyCode.GetCode();
- SwView* pView = mpMarginWin->DocView();
- if ((rKeyCode.IsMod1() && rKeyCode.IsMod2()) && ((nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN)))
- mpMarginWin->SwitchToPostIt(nKey);
- else
- if ((nKey == KEY_ESCAPE) || (rKeyCode.IsMod1() && ((nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN))))
- mpMarginWin->SwitchToFieldPos();
- else
- if (nKey == KEY_INSERT)
- {
- if (!rKeyCode.IsMod1() && !rKeyCode.IsMod2())
- mpMarginWin->ToggleInsMode();
- }
- else
- {
- //let's make sure we see our note
- mpMarginWin->Mgr()->MakeVisible(mpMarginWin);
-
- long aOldHeight = mpMarginWin->GetPostItTextHeight();
- bool bDone = false;
-
- /// HACK: need to switch off processing of Undo/Redo in Outliner
- if ( !( (nKey == KEY_Z || nKey == KEY_Y) && rKeyCode.IsMod1()) )
- {
- /*
- SwPostItHelper::SwLayoutStatus aStatus = mpMarginWin->GetStatus();
- if ( (aStatus!=SwPostItHelper::DELETED) ||
- ( (aStatus==SwPostItHelper::DELETED) && (!mpMarginWin->Engine()->GetEditEngine().DoesKeyChangeText(rKeyEvt))) )
- */
- bool bIsProtected = mpMarginWin->IsProtected();
- if (!bIsProtected || (bIsProtected && !mpMarginWin->Engine()->GetEditEngine().DoesKeyChangeText(rKeyEvt)) )
- bDone = mpOutlinerView->PostKeyEvent( rKeyEvt );
- else
- InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute();
- }
- if (bDone)
- mpMarginWin->ResizeIfNeccessary(aOldHeight,mpMarginWin->GetPostItTextHeight());
- else
- {
- // write back data first when showing navigator
- if ( nKey==KEY_F5 )
- mpMarginWin->UpdateData();
- if (!pView->KeyInput(rKeyEvt))
- Window::KeyInput(rKeyEvt);
- }
- }
-
- pView->GetViewFrame()->GetBindings().InvalidateAll(FALSE);
-}
-
-void PostItTxt::MouseMove( const MouseEvent& rMEvt )
-{
- if ( mpOutlinerView )
- {
- mpOutlinerView->MouseMove( rMEvt );
- // mba: why does OutlinerView not handle the modifier setting?!
- // this forces the postit to handle *all* pointer types
- SetPointer( mpOutlinerView->GetPointer( rMEvt.GetPosPixel() ) );
-
- const EditView& aEV = mpOutlinerView->GetEditView();
- const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer();
- if ( pItem )
- {
- const SvxFieldData* pFld = pItem->GetField();
- const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld );
- if ( pURL )
- {
- String sURL( pURL->GetURL() );
- SvtSecurityOptions aSecOpts;
- if ( aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK) )
- {
- sURL.InsertAscii( ": ", 0 );
- sURL.Insert( ViewShell::GetShellRes()->aHyperlinkClick, 0 );
- }
- Help::ShowQuickHelp( this,PixelToLogic(Rectangle(GetPosPixel(),Size(50,10))),sURL);
- }
- }
- }
-}
-
-void PostItTxt::MouseButtonDown( const MouseEvent& rMEvt )
-{
- if (mpOutlinerView )
- {
- SvtSecurityOptions aSecOpts;
- bool bExecuteMod = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK);
-
- if ( !bExecuteMod || (bExecuteMod && rMEvt.GetModifier() == KEY_MOD1))
- {
- const EditView& aEV = mpOutlinerView->GetEditView();
- const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer();
- if ( pItem )
- {
- const SvxFieldData* pFld = pItem->GetField();
- const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld );
- if ( pURL )
- {
- mpOutlinerView->MouseButtonDown( rMEvt );
- SwWrtShell &rSh = mpMarginWin->DocView()->GetWrtShell();
- String sURL( pURL->GetURL() );
- String sTarget( pURL->GetTargetFrame() );
- ::LoadURL( sURL, &rSh, URLLOAD_NOFILTER, &sTarget);
- return;
- }
- }
- }
- }
-
- GrabFocus();
- if ( mpOutlinerView )
- mpOutlinerView->MouseButtonDown( rMEvt );
- mpMarginWin->DocView()->GetViewFrame()->GetBindings().InvalidateAll(FALSE);
-}
-
-void PostItTxt::MouseButtonUp( const MouseEvent& rMEvt )
-{
- if ( mpOutlinerView )
- mpOutlinerView->MouseButtonUp( rMEvt );
-}
-
-IMPL_LINK(PostItTxt, OnlineSpellCallback, SpellCallbackInfo*, pInfo)
-{
- if ( mpMarginWin && (pInfo->nCommand == SPELLCMD_STARTSPELLDLG) )
- mpMarginWin->DocView()->GetViewFrame()->GetDispatcher()->Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON);
- return 0;
-}
-
-IMPL_LINK( PostItTxt, Select, Menu*, pSelMenu )
-{
- mpMarginWin->ExecuteCommand( pSelMenu->GetCurItemId() );
- return 0;
-}
-
-void PostItTxt::Command( const CommandEvent& rCEvt )
-{
- if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
- {
- if (!mpMarginWin->IsProtected() &&
- //if (!mpMarginWin->IsReadOnly() && (mpMarginWin->GetStatus()!=SwPostItHelper::DELETED) &&
- mpOutlinerView->IsWrongSpelledWordAtPos( rCEvt.GetMousePosPixel(),TRUE ))
- {
- Link aLink = LINK(this, PostItTxt, OnlineSpellCallback);
- mpOutlinerView->ExecuteSpellPopup(rCEvt.GetMousePosPixel(),&aLink);
- }
- else
- {
- SfxPopupMenuManager* aMgr = mpMarginWin->DocView()->GetViewFrame()->GetDispatcher()->Popup(0, this,&rCEvt.GetMousePosPixel());
- XubString aText = ((PopupMenu*)aMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR );
- SwRewriter aRewriter;
- aRewriter.AddRule(UNDO_ARG1, mpMarginWin->GetAuthor());
- aText = aRewriter.Apply(aText);
- ((PopupMenu*)aMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
- // SwPostItLinkForwarder_Impl aFwd( ((PopupMenu*)aMgr->GetSVMenu())->pSvMenu->GetSelectHdl(), mpPostIt );
- // ((PopupMenu*)aMgr->GetSVMenu())->pSvMenu->SetSelectHdl( LINK(&aFwd, SwPostItLinkForwarder_Impl, Select) );
-
- ((PopupMenu*)aMgr->GetSVMenu())->SetSelectHdl( LINK(this, PostItTxt, Select) );
-
- if (rCEvt.IsMouseEvent())
- ((PopupMenu*)aMgr->GetSVMenu())->Execute(this,rCEvt.GetMousePosPixel());
- else
- {
- const Size aSize = GetSizePixel();
- const Point aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 );
- ((PopupMenu*)aMgr->GetSVMenu())->Execute(this,aPos);
- }
- delete aMgr;
- }
- }
- else
- if (rCEvt.GetCommand() == COMMAND_WHEEL)
- {
- if (mpMarginWin->Scrollbar()->IsVisible())
- {
- const CommandWheelData* pData = rCEvt.GetWheelData();
- if (pData->IsShift() || pData->IsMod1() || pData->IsMod2())
- {
- mpMarginWin->DocView()->HandleWheelCommands(rCEvt);
- }
- else
- {
- HandleScrollCommand( rCEvt, 0 , mpMarginWin->Scrollbar());
-
- /*
- long nLines = pData->GetNotchDelta() * (long)pData->GetScrollLines();
- if ( ((mpMarginWin->Scrollbar()->GetRange().Min() == mpMarginWin->Scrollbar()->GetThumbPos()) && (nLines > 0)) ||
- ( (mpMarginWin->Scrollbar()->GetRange().Max() == mpMarginWin->Scrollbar()->GetThumbPos()+mpMarginWin->Scrollbar()->GetVisibleSize()) && (nLines < 0)) )
- {
- mpMarginWin->DocView()->HandleWheelCommands(rCEvt);
- }
- else
- {
- HandleScrollCommand( rCEvt, 0 , mpMarginWin->Scrollbar());
- }
- */
- }
- }
- else
- {
- mpMarginWin->DocView()->HandleWheelCommands(rCEvt);
- }
- }
- else
- {
- if ( mpOutlinerView )
- mpOutlinerView->Command( rCEvt );
- else
- Window::Command(rCEvt);
- }
-}
-
-void PostItTxt::DataChanged( const DataChangedEvent& aData)
-{
- Window::DataChanged( aData );
-}
-
-IMPL_LINK( PostItTxt, WindowEventListener, VclSimpleEvent*, pWinEvent )
-{
- if ( pWinEvent && pWinEvent->ISA( VclWindowEvent ) )
- {
- VclWindowEvent *pEvent = (VclWindowEvent*)pWinEvent;
- if (pEvent->GetId() == VCLEVENT_WINDOW_MOUSEMOVE)
- {
- MouseEvent* pMouseEvt = (MouseEvent*)pEvent->GetData();
- if ( pMouseEvt->IsEnterWindow() )
- {
- mMouseOver = true;
- if (!mbShowPopup && !HasFocus())
- {
- mpMarginWin->SetViewState(SS_VIEW);
- Invalidate();
- }
- }
- else if ( pMouseEvt->IsLeaveWindow())
- {
- if (mpMarginWin->IsPreview())
- {
- //mpMarginWin->doLazyDelete();
- }
- else
- {
- mMouseOver = false;
- if (!mbShowPopup && !HasFocus())
- {
- mpMarginWin->SetViewState(SS_NORMAL);
- Invalidate();
- }
- }
- }
- }
- }
- return sal_True;
-}
-
-XubString PostItTxt::GetSurroundingText() const
-{
- if( mpOutlinerView )
- return mpOutlinerView->GetSurroundingText();
- else
- return XubString::EmptyString();
-}
-
-Selection PostItTxt::GetSurroundingTextSelection() const
-{
- if( mpOutlinerView )
- return mpOutlinerView->GetSurroundingTextSelection();
- else
- return Selection( 0, 0 );
-}
-
-/************** SwMarginWin***********************************++*/
-SwMarginWin::SwMarginWin(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits)
-: Window(pParent, nBits),
- mnEventId(0),
- mpOutlinerView(0),
- mpOutliner(0),
- mpPostItTxt(0),
- mpMeta(0),
- mpVScrollbar(0),
- mpAnkor(0),
- mpShadow(0),
- mpMgr(aMgr),
- mbMeta(true),
- nFlags(aBits),
- mbMouseOverButton(false),
- mpButtonPopup(0),
- mbIsFollow(false)
-{
- SwEditWin* aWin = static_cast<SwEditWin*>(GetParent());
- mpView = &aWin->GetView();
-
- SdrPaintWindow* pPaintWindow = mpView->GetDrawView()->GetPaintWindow(0);
- if(pPaintWindow)
- {
- pOverlayManager = pPaintWindow->GetOverlayManager();
-
- mpShadow = new SwPostItShadow(basegfx::B2DPoint(0,0),basegfx::B2DPoint(0,0),Color(0,0,0),SS_NORMAL);
- mpShadow->setVisible(false);
- pOverlayManager->add(*mpShadow);
- }
-}
-
-SwMarginWin::~SwMarginWin()
-{
- if (mpOutlinerView)
- {
- delete mpOutlinerView;
- }
-
- if (mpOutliner)
- {
- delete mpOutliner;
- }
-
- if (mpMeta)
- {
- mpMeta->RemoveEventListener( LINK( mpPostItTxt, PostItTxt, WindowEventListener ) );
- delete mpMeta;
- }
-
- if (mpPostItTxt)
- {
- delete mpPostItTxt;
- }
-
- if (mpVScrollbar)
- {
- delete mpVScrollbar;
- }
-
- if (mpAnkor)
- {
- if (mpAnkor->getOverlayManager())
- {
- // remove this object from the chain
- mpAnkor->getOverlayManager()->remove(*mpAnkor);
- }
- delete mpAnkor;
- }
-
- if (mpShadow)
- {
- if (mpShadow->getOverlayManager())
- {
- mpShadow->getOverlayManager()->remove(*mpShadow);
- }
- delete mpShadow;
- }
-
- if (mpButtonPopup)
- {
- delete mpButtonPopup;
- }
-
- if (mnEventId)
- Application::RemoveUserEvent( mnEventId );
-}
-
-void SwMarginWin::Paint( const Rectangle& rRect)
-{
- Window::Paint(rRect);
-
- if (mpMeta->IsVisible() )
- {
- //draw left over space
- if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- SetFillColor(COL_BLACK);
- else
- SetFillColor(mColorDark);
- SetLineColor();
- DrawRect(PixelToLogic(Rectangle(Point(mpMeta->GetPosPixel().X()+mpMeta->GetSizePixel().Width(),mpMeta->GetPosPixel().Y()),Size(GetMetaButtonAreaWidth(),mpMeta->GetSizePixel().Height()))));
-
- if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode())
- {
- //draw rect around button
- SetFillColor(COL_BLACK);
- SetLineColor(COL_WHITE);
- }
- else
- {
- //draw button
- Gradient aGradient;
- if (mbMouseOverButton)
- aGradient = Gradient(GRADIENT_LINEAR,ColorFromAlphaColor(80,mColorAnkor,mColorDark),ColorFromAlphaColor(15,mColorAnkor,mColorDark));
- else
- aGradient = Gradient(GRADIENT_LINEAR,ColorFromAlphaColor(15,mColorAnkor,mColorDark),ColorFromAlphaColor(80,mColorAnkor,mColorDark));
- DrawGradient(mRectMetaButton,aGradient);
- //draw rect around button
- SetFillColor();
- SetLineColor(ColorFromAlphaColor(90,mColorAnkor,mColorDark));
- }
- DrawRect(mRectMetaButton);
-
- if (IsPreview())
- {
- Font aOldFont( GetFont());
- Font aFont(aOldFont);
- Color aCol( COL_BLACK);
- aFont.SetColor( aCol );
- aFont.SetHeight(200);
- aFont.SetWeight(WEIGHT_MEDIUM);
- SetFont( aFont );
- DrawText(mRectMetaButton,rtl::OUString::createFromAscii("Edit Note"),TEXT_DRAW_CENTER);
- SetFont( aOldFont );
- }
- else
- {
- //draw arrow
- if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- SetFillColor(COL_WHITE);
- else
- SetFillColor(COL_BLACK);
- SetLineColor();
- DrawPolygon(Polygon(aPopupTriangle));
- }
- }
-}
-
-void SwMarginWin::SetPosSizePixelRect(long nX, long nY,long nWidth, long nHeight,const SwRect &aRect, const long aPageBorder)
-{
- mbMeta = true;
- mPosSize = Rectangle(Point(nX,nY),Size(nWidth,nHeight));
- mAnkorRect = aRect;
- mPageBorder = aPageBorder;
-}
-
-void SwMarginWin::SetSize( const Size& rNewSize )
-{
- mPosSize.SetSize(rNewSize);
-}
-
-void SwMarginWin::SetVirtualPosSize( const Point& aPoint, const Size& aSize)
-{
- mPosSize = Rectangle(aPoint,aSize);
-}
-
-void SwMarginWin::TranslateTopPosition(const long aAmount)
-{
- mPosSize.Move(0,aAmount);
-}
-
-void SwMarginWin::ShowAnkorOnly(const Point &aPoint)
-{
- HideNote();
- SetPosAndSize();
- if (mpAnkor)
- {
- mpAnkor->SetSixthPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
- mpAnkor->SetSeventhPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
- mpAnkor->SetAnkorState(AS_ALL);
- mpAnkor->setVisible(true);
- }
- if (mpShadow)
- mpShadow->setVisible(false);
-}
-
-SfxItemSet SwMarginWin::DefaultItem()
-{
- SfxItemSet aItem( mpView->GetDocShell()->GetPool() );
- aItem.Put(SvxFontHeightItem(200,100,EE_CHAR_FONTHEIGHT));
- aItem.Put(SvxFontItem(FAMILY_SWISS,GetSettings().GetStyleSettings().GetFieldFont().GetName(),
- EMPTYSTRING,PITCH_DONTKNOW,RTL_TEXTENCODING_DONTKNOW,EE_CHAR_FONTINFO));
- return aItem;
-}
-
-void SwMarginWin::InitControls()
-{
- // actual window which holds the user text
- mpPostItTxt = new PostItTxt(this, WB_NODIALOGCONTROL);
- mpPostItTxt->SetPointer(Pointer(POINTER_TEXT));
-
- // window control for author and date
- mpMeta = new MultiLineEdit(this,0);
- mpMeta->SetReadOnly();
- mpMeta->SetRightToLeft(Application::GetSettings().GetLayoutRTL());
- mpMeta->AlwaysDisableInput(true);
- mpMeta->SetCallHandlersOnInputDisabled(true);
- mpMeta->AddEventListener( LINK( mpPostItTxt, PostItTxt, WindowEventListener ) );
- AddEventListener( LINK( mpPostItTxt, PostItTxt, WindowEventListener ) );
-
- // we should leave this setting alone, but for this we need a better layout algo
- // with variable meta size height
- AllSettings aSettings = mpMeta->GetSettings();
- StyleSettings aStyleSettings = aSettings.GetStyleSettings();
- Font aFont = aStyleSettings.GetFieldFont();
- aFont.SetHeight(8);
- aStyleSettings.SetFieldFont(aFont);
- aSettings.SetStyleSettings(aStyleSettings);
- mpMeta->SetSettings(aSettings);
-
- SwDocShell* aShell = mpView->GetDocShell();
- mpOutliner = new Outliner(&aShell->GetPool(),OUTLINERMODE_TEXTOBJECT);
- aShell->GetDoc()->SetCalcFieldValueHdl( mpOutliner );
- // mpOutliner->EnableUndo( FALSE );
- mpOutliner->SetUpdateMode( TRUE );
- Rescale();
-
- OutputDevice* pDev = aShell->GetDoc()->getReferenceDevice(TRUE);
- if ( pDev )
- {
- mpOutliner->SetRefDevice( pDev );
- }
-
- mpOutlinerView = new OutlinerView ( mpOutliner, mpPostItTxt );
- mpOutlinerView->SetBackgroundColor(COL_TRANSPARENT);
- mpOutliner->InsertView(mpOutlinerView );
- mpPostItTxt->SetTextView(mpOutlinerView);
- mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,1,1) ) );
-
- mpOutlinerView->SetAttribs(DefaultItem());
-
- // TODO: ??
- EEHorizontalTextDirection aDefHoriTextDir = Application::GetSettings().GetLayoutRTL() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
- mpOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir );
-
- //create Scrollbars
- mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
- mpVScrollbar->EnableNativeWidget(false);
- mpVScrollbar->EnableRTL( false );
- mpVScrollbar->SetScrollHdl(LINK(this, SwMarginWin, ScrollHdl));
- mpVScrollbar->EnableDrag();
- mpVScrollbar->AddEventListener( LINK( mpPostItTxt, PostItTxt, WindowEventListener ) );
-
- const SwViewOption* pVOpt = mpView->GetWrtShellPtr()->GetViewOptions();
- ULONG nCntrl = mpOutliner->GetControlWord();
- // TODO: crash when AUTOCOMPLETE enabled
- nCntrl |= EE_CNTRL_MARKFIELDS | EE_CNTRL_PASTESPECIAL | EE_CNTRL_AUTOCORRECT | EV_CNTRL_AUTOSCROLL | EE_CNTRL_URLSFXEXECUTE; // | EE_CNTRL_AUTOCOMPLETE;
- if (pVOpt->IsFieldShadings())
- nCntrl |= EE_CNTRL_MARKFIELDS;
- else
- nCntrl &= ~EE_CNTRL_MARKFIELDS;
- if (pVOpt->IsOnlineSpell())
- nCntrl |= EE_CNTRL_ONLINESPELLING;
- else
- nCntrl &= ~EE_CNTRL_ONLINESPELLING;
- mpOutliner->SetControlWord(nCntrl);
-
- sal_uInt16 aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor());
- SetColor(mpMgr->GetColorDark(aIndex),mpMgr->GetColorLight(aIndex),mpMgr->GetColorAnkor(aIndex));
-
- CheckMetaText();
- SetPopup();
- SetLanguage(GetLanguage());
- View()->StartSpeller();
- SetPostItText();
- Engine()->CompleteOnlineSpelling();
-
- mpMeta->Show();
- mpVScrollbar->Show();
- mpPostItTxt->Show();
-}
-
-void SwMarginWin::CheckMetaText()
-{
- const LocaleDataWrapper& rLocalData = SvtSysLocale().GetLocaleData();
- String sMeta = GetAuthor();
- if (sMeta==String(EMPTYSTRING))
- sMeta = String(SW_RES(STR_NOAUTHOR));
- if (sMeta.Len() > 22)
- {
- sMeta.Erase(20);
- sMeta = sMeta + rtl::OUString::createFromAscii("...");
- }
- Date aDate = GetDate();
- if (aDate==Date())
- sMeta = sMeta + LINEBREAK + String(SW_RES(STR_POSTIT_TODAY));
- else
- if (aDate == Date(Date()-1))
- sMeta = sMeta + LINEBREAK + String(SW_RES(STR_POSTIT_YESTERDAY));
- else
- if (aDate.IsValid() )
- sMeta = sMeta + LINEBREAK + rLocalData.getDate(aDate);
- else
- sMeta = sMeta + LINEBREAK + String(SW_RES(STR_NODATE));
- if (GetTime()!=0)
- sMeta = sMeta + rtl::OUString::createFromAscii(" ") + rLocalData.getTime( GetTime(),false );
- if (mpMeta->GetText() != sMeta)
- mpMeta->SetText(sMeta);
-}
-
-void SwMarginWin::Rescale()
-{
- MapMode aMode = GetParent()->GetMapMode();
- aMode.SetOrigin( Point() );
- //aMode.SetScaleX( aMode.GetScaleX() * Fraction( 8, 10 ) );
- //aMode.SetScaleY( aMode.GetScaleY() * Fraction( 8, 10 ) );
- mpOutliner->SetRefMapMode( aMode );
- SetMapMode( aMode );
- mpPostItTxt->SetMapMode( aMode );
- if ( mpMeta )
- {
- Font aFont( mpMeta->GetSettings().GetStyleSettings().GetFieldFont() );
- sal_Int32 nHeight = aFont.GetHeight();
- nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
- aFont.SetHeight( nHeight );
- mpMeta->SetControlFont( aFont );
- }
-}
-
-void SwMarginWin::SetPosAndSize()
-{
- bool bChange = false;
-
- if (GetSizePixel() != mPosSize.GetSize())
- {
- bChange = true;
- SetSizePixel(mPosSize.GetSize());
- DoResize();
- }
-
- if (GetPosPixel().X() != mPosSize.TopLeft().X() || (abs(GetPosPixel().Y() - mPosSize.TopLeft().Y()) > 5) )
- {
- bChange = true;
- SetPosPixel(mPosSize.TopLeft());
-
- Point aLineStart;
- Point aLineEnd ;
- if (mbMarginSide)
- {
- aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
- aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
- }
- else
- {
- aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
- aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
- }
-
- if (!IsPreview())
- {
- if (mpAnkor)
- {
- mpAnkor->SetAllPosition(basegfx::B2DPoint( mAnkorRect.Left() , mAnkorRect.Bottom() - 5* 15),
- basegfx::B2DPoint( mAnkorRect.Left()-5*15 , mAnkorRect.Bottom()+5*15),
- basegfx::B2DPoint( mAnkorRect.Left()+5*15 , mAnkorRect.Bottom()+5*15),
- basegfx::B2DPoint( mAnkorRect.Left(), mAnkorRect.Bottom()+2*15),
- basegfx::B2DPoint( mPageBorder ,mAnkorRect.Bottom()+2*15),
- basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
- basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()));
- mpAnkor->SetHeight(mAnkorRect.Height());
- }
- else
- {
- mpAnkor = new SwPostItAnkor(basegfx::B2DPoint( mAnkorRect.Left() , mAnkorRect.Bottom()-5*15),
- basegfx::B2DPoint( mAnkorRect.Left()-5*15 , mAnkorRect.Bottom()+5*15),
- basegfx::B2DPoint( mAnkorRect.Left()+5*15 , mAnkorRect.Bottom()+5*15),
- basegfx::B2DPoint( mAnkorRect.Left(), mAnkorRect.Bottom()+2*15),
- basegfx::B2DPoint( mPageBorder ,mAnkorRect.Bottom()+2*15),
- basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
- basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()) ,
- mColorAnkor,
- false,
- false);
- mpAnkor->SetHeight(mAnkorRect.Height());
- mpAnkor->setVisible(true);
- mpAnkor->SetAnkorState(AS_TRI);
- if (HasChildPathFocus())
- {
- mpAnkor->setLineSolid(true);
- }
- pOverlayManager->add(*mpAnkor);
- }
- }
- }
- else
- {
- if ( mpAnkor && (mpAnkor->getBasePosition() != basegfx::B2DPoint( mAnkorRect.Left() , mAnkorRect.Bottom()-5*15)) )
- mpAnkor->SetTriPosition(basegfx::B2DPoint( mAnkorRect.Left() , mAnkorRect.Bottom() - 5* 15),
- basegfx::B2DPoint( mAnkorRect.Left()-5*15 , mAnkorRect.Bottom()+5*15),
- basegfx::B2DPoint( mAnkorRect.Left()+5*15 , mAnkorRect.Bottom()+5*15),
- basegfx::B2DPoint( mAnkorRect.Left(), mAnkorRect.Bottom()+2*15),
- basegfx::B2DPoint( mPageBorder ,mAnkorRect.Bottom()+2*15));
- }
-
- if (bChange)
- {
- Point aStart = EditWin()->PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height()));
- Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height()));
- mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
- }
-
- if (mpMgr->ShowNotes())
- {
- if (IsFollow() && !HasChildPathFocus())
- {
- mpAnkor->SetAnkorState(AS_END);
- }
- else
- {
- mpAnkor->SetAnkorState(AS_ALL);
- SwMarginWin* pWin = GetTopReplyNote();
- if (pWin)
- pWin->Ankor()->SetAnkorState(AS_END);
- }
- }
-}
-
-void SwMarginWin::DoResize()
-{
- long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height();
- long aHeight = GetSizePixel().Height();
- unsigned long aWidth = GetSizePixel().Width();
-
- if (mbMeta)
- {
- aHeight -= GetMetaHeight();
- mpMeta->Show();
- mpPostItTxt->SetQuickHelpText(EMPTYSTRING);
- }
- else
- {
- mpMeta->Hide();
- mpPostItTxt->SetQuickHelpText(mpMeta->GetText());
- }
-
- if ((aTextHeight > aHeight) && !IsPreview())
- { // we need vertical scrollbars and have to reduce the width
- aWidth -= GetScrollbarWidth();
- mpVScrollbar->Show();
- }
- else
- {
- mpVScrollbar->Hide();
- }
-
- mpMeta->SetPosSizePixel(0,aHeight,GetSizePixel().Width()-GetMetaButtonAreaWidth(),GetMetaHeight());
- mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ;
- mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
- if (!mpVScrollbar->IsVisible())
- { // if we do not have a scrollbar anymore, we want to see the complete text
- mpOutlinerView->SetVisArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
- }
-
- if (!Application::GetSettings().GetLayoutRTL())
- {
- mpPostItTxt->SetPosSizePixel(0, 0, aWidth, aHeight);
- mpVScrollbar->SetPosSizePixel( aWidth, 0, GetScrollbarWidth(), aHeight);
- }
- else
- {
- mpPostItTxt->SetPosSizePixel((aTextHeight > aHeight) && !IsPreview() ? GetScrollbarWidth() : 0 , 0, aWidth, aHeight);
- mpVScrollbar->SetPosSizePixel( 0, 0, GetScrollbarWidth(), aHeight);
- }
-
- mpVScrollbar->SetVisibleSize( PixelToLogic(Size(0,aHeight)).Height() );
- mpVScrollbar->SetPageSize( PixelToLogic(Size(0,aHeight)).Height() * 8 / 10 );
- mpVScrollbar->SetLineSize( mpOutliner->GetTextHeight() / 10 );
- SetScrollbar();
- mpVScrollbar->SetRange( Range(0, mpOutliner->GetTextHeight()));
-
- //calculate rects for meta- button
- const Fraction& fx( GetMapMode().GetScaleX() );
- const Fraction& fy( GetMapMode().GetScaleY() );
-
- Point aPos( mpMeta->GetPosPixel());
- Point aBase( aPos.X() + aPos.X() + GetSizePixel().Width(), aPos.Y() );
- Point aLeft = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH+5)*fx.GetNumerator()/fx.GetDenominator(), aBase.Y()+17*fy.GetNumerator()/fx.GetDenominator() ) );
- Point aRight = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH-1)*fx.GetNumerator()/fx.GetDenominator(), aBase.Y()+17*fy.GetNumerator()/fy.GetDenominator() ) );
- Point aBottom = PixelToLogic( Point( aBase.X() - (METABUTTON_WIDTH+2)*fx.GetNumerator()/fx.GetDenominator(), aBase.Y()+20*fy.GetNumerator()/fy.GetDenominator() ) );
-
- aPopupTriangle.clear();
- aPopupTriangle.append(basegfx::B2DPoint(aLeft.X(),aLeft.Y()));
- aPopupTriangle.append(basegfx::B2DPoint(aRight.X(),aRight.Y()));
- aPopupTriangle.append(basegfx::B2DPoint(aBottom.X(),aBottom.Y()));
- aPopupTriangle.setClosed(true);
- if (IsPreview())
- mRectMetaButton = PixelToLogic( Rectangle( Point(
- aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH*4+10)*fx.GetNumerator()/fx.GetDenominator(),
- aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ),
- Size( METABUTTON_WIDTH*4*fx.GetNumerator()/fx.GetDenominator(), METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) );
- else
- mRectMetaButton = PixelToLogic( Rectangle( Point(
- aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx.GetNumerator()/fx.GetDenominator(),
- aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ),
- Size( METABUTTON_WIDTH*fx.GetNumerator()/fx.GetDenominator(), METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) );
-}
-
-void SwMarginWin::SetSizePixel( const Size& rNewSize )
-{
- Window::SetSizePixel(rNewSize);
-
- if (mpShadow)
- {
- Point aStart = EditWin()->PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height()));
- Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height()));
- mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
- }
-}
-
-void SwMarginWin::SetScrollbar()
-{
- mpVScrollbar->SetThumbPos( mpOutlinerView->GetVisArea().Top()+ mpOutlinerView->GetEditView().GetCursor()->GetOffsetY());
-}
-
-void SwMarginWin::ResizeIfNeccessary(long aOldHeight, long aNewHeight)
-{
- if (aOldHeight != aNewHeight)
- {
- //check for lower border or next note
- long aBorder = mpMgr->GetNextBorder();
- if (aBorder != -1)
- {
- if (aNewHeight > GetMinimumSizeWithoutMeta())
- {
- long aNewLowerValue = GetPosPixel().Y() + aNewHeight + GetMetaHeight();
- if (aNewLowerValue < aBorder)
- SetSizePixel(Size(GetSizePixel().Width(),aNewHeight+GetMetaHeight()));
- else
- SetSizePixel(Size(GetSizePixel().Width(),aBorder - GetPosPixel().Y()));
- DoResize();
- Invalidate();
- }
- else
- {
- if (GetSizePixel().Height() != GetMinimumSizeWithoutMeta() + GetMetaHeight())
- SetSizePixel(Size(GetSizePixel().Width(),GetMinimumSizeWithoutMeta() + GetMetaHeight()));
- DoResize();
- Invalidate();
- }
- }
- else
- {
- DoResize();
- Invalidate();
- }
- }
- else
- {
- SetScrollbar();
- }
-}
-
-void SwMarginWin::SetColor(Color aColorDark,Color aColorLight, Color aColorAnkor)
-{
- mColorDark = aColorDark;
- mColorLight = aColorLight;
- mColorAnkor = aColorAnkor;
-
- if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- {
- //Wallpaper aWall(Gradient(GRADIENT_LINEAR,mColorLight,mColorDark));
- //mpPostItTxt->SetBackground(aWall);
-
- mpMeta->SetControlBackground(mColorDark);
- AllSettings aSettings = mpMeta->GetSettings();
- StyleSettings aStyleSettings = aSettings.GetStyleSettings();
- aStyleSettings.SetFieldTextColor(aColorAnkor);
- aSettings.SetStyleSettings(aStyleSettings);
- mpMeta->SetSettings(aSettings);
-
- AllSettings aSettings2 = mpVScrollbar->GetSettings();
- StyleSettings aStyleSettings2 = aSettings2.GetStyleSettings();
- aStyleSettings2.SetButtonTextColor(Color(0,0,0));
- //aStyleSettings2.SetLightColor(mColorAnkor);
- aStyleSettings2.SetCheckedColor(mColorLight); //hintergund
- //aStyleSettings2.SetLightBorderColor(mColorAnkor);
- aStyleSettings2.SetShadowColor(mColorAnkor);
- aStyleSettings2.SetFaceColor(mColorDark);
- aSettings2.SetStyleSettings(aStyleSettings2);
- mpVScrollbar->SetSettings(aSettings2);
- }
-}
-
-void SwMarginWin::SetMarginSide(bool aMarginSide)
-{
- mbMarginSide = aMarginSide;
-}
-
-void SwMarginWin::SetReadonly(BOOL bSet)
-{
- mbReadonly = bSet;
- View()->SetReadOnly(bSet);
-}
-
-void SwMarginWin::SetLanguage(const SvxLanguageItem aNewItem)
-{
- Engine()->SetModifyHdl( Link() );
- ESelection aOld = View()->GetSelection();
-
- ESelection aNewSelection( 0, 0, (USHORT)Engine()->GetParagraphCount()-1, USHRT_MAX );
- View()->SetSelection( aNewSelection );
- SfxItemSet aEditAttr(View()->GetAttribs());
- aEditAttr.Put(aNewItem);
- View()->SetAttribs( aEditAttr );
-
- View()->SetSelection(aOld);
- Engine()->SetModifyHdl( LINK( this, SwPostIt, ModifyHdl ) );
-
- const SwViewOption* pVOpt = DocView()->GetWrtShellPtr()->GetViewOptions();
- ULONG nCntrl = Engine()->GetControlWord();
- // turn off
- if (!pVOpt->IsOnlineSpell())
- nCntrl &= ~EE_CNTRL_ONLINESPELLING;
- else
- nCntrl &= ~EE_CNTRL_ONLINESPELLING;
- Engine()->SetControlWord(nCntrl);
-
- //turn back on
- if (pVOpt->IsOnlineSpell())
- nCntrl |= EE_CNTRL_ONLINESPELLING;
- else
- nCntrl &= ~EE_CNTRL_ONLINESPELLING;
- Engine()->SetControlWord(nCntrl);
-
- Engine()->CompleteOnlineSpelling();
- Invalidate();
-}
-
-void SwMarginWin::DataChanged( const DataChangedEvent& aEvent)
-{
- Window::DataChanged( aEvent );
-}
-
-void SwMarginWin::GetFocus()
-{
- if (mpPostItTxt)
- mpPostItTxt->GrabFocus();
-}
-
-void SwMarginWin::LoseFocus()
-{
-}
-
-void SwMarginWin::ShowNote()
-{
- SetPosAndSize();
- if (!IsVisible())
- Window::Show();
- if (mpAnkor && !mpShadow->isVisible())
- mpShadow->setVisible(true);
- if (mpAnkor && !mpAnkor->isVisible())
- mpAnkor->setVisible(true);
-}
-
-void SwMarginWin::HideNote()
-{
- if (IsVisible())
- Window::Hide();
- if (mpAnkor)
- {
- if (mpMgr->IsShowAnkor())
- mpAnkor->SetAnkorState(AS_TRI);
- else
- mpAnkor->setVisible(false);
- }
- if (mpShadow && mpShadow->isVisible())
- mpShadow->setVisible(false);
-}
-
-void SwMarginWin::ActivatePostIt()
-{
- mpMgr->AssureStdModeAtShell();
-
- mpOutliner->ClearModifyFlag();
- mpOutliner->GetUndoManager().Clear();
-
- CheckMetaText();
- SetViewState(SS_EDIT);
- View()->ShowCursor();
-
- mpOutlinerView->GetEditView().SetInsertMode(mpView->GetWrtShellPtr()->IsInsMode());
-
- if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- View()->SetBackgroundColor(mColorDark);
-
- // mpPostItTxt->SetBackground(Wallpaper(mColorDark));
-}
-
-void SwMarginWin::DeactivatePostIt()
-{
- // remove selection, #i87073#
- if (View()->GetEditView().HasSelection())
- {
- ESelection aSelection = View()->GetEditView().GetSelection();
- aSelection.nEndPara = aSelection.nStartPara;
- aSelection.nEndPos = aSelection.nStartPos;
- View()->GetEditView().SetSelection(aSelection);
- }
-
- mpOutliner->CompleteOnlineSpelling();
-
- SetViewState(SS_NORMAL);
- // write the visible text back into the SwField
- UpdateData();
-
- if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- View()->SetBackgroundColor(COL_TRANSPARENT);
-
- //mpPostItTxt->SetBackground(Gradient(GRADIENT_LINEAR,mColorLight,mColorDark));
-
- if ( !IsProtected() &&
- //if (!IsReadOnly() && (GetStatus()!=SwPostItHelper::DELETED) &&
- Engine()->GetEditEngine().GetText()==String(EMPTYSTRING) )
- mnEventId = Application::PostUserEvent( LINK( this, SwMarginWin, DeleteHdl), 0 );
-}
-
-void SwMarginWin::ToggleInsMode()
-{
- if (!mpView->GetWrtShell().IsRedlineOn())
- {
- //change outliner
- mpOutlinerView->GetEditView().SetInsertMode(!mpOutlinerView->GetEditView().IsInsertMode());
- //change documnet
- mpView->GetWrtShell().ToggleInsMode();
- //update statusbar
- SfxBindings &rBnd = mpView->GetViewFrame()->GetBindings();
- rBnd.Invalidate(SID_ATTR_INSERT);
- rBnd.Update(SID_ATTR_INSERT);
- }
-}
-
-void SwMarginWin::ExecuteCommand(USHORT nSlot)
-{
- mpMgr->AssureStdModeAtShell();
-
- switch (nSlot)
- {
- case FN_POSTIT:
- case FN_REPLY:
- {
- // if this note is empty, it will be deleted once losing the focus, so no reply, but only a new note
- // will be created
- SwView* pView = DocView();
- if (Engine()->GetEditEngine().GetText() != String(EMPTYSTRING))
- {
- OutlinerParaObject* pPara = new OutlinerParaObject(*View()->GetEditView().CreateTextObject());
- Mgr()->RegisterAnswer(pPara);
- }
- if (Mgr()->GetActivePostIt())
- Mgr()->SetActivePostIt(0);
- SwitchToFieldPos();
- pView->GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
- break;
- }
- case FN_DELETE_COMMENT:
- case FN_DELETE_NOTE:
-
- //Delete(); // do not kill the parent of our open popup menu
- mnEventId = Application::PostUserEvent( LINK( this, SwMarginWin, DeleteHdl), 0 );
- break;
- /*
- case FN_HIDE_NOTE:
- if ( Mgr()->GetActivePostIt() == this )
- {
- Mgr()->SetActivePostIt(0);
- // put the cursor back into the document
- SwitchToFieldPos();
- }
- Mgr()->Hide(mpFld);
- break;
- */
- case FN_DELETE_ALL_NOTES:
- case FN_HIDE_ALL_NOTES:
- // not possible as slot as this would require that "this" is the active postit
- DocView()->GetViewFrame()->GetBindings().Execute( nSlot, 0, 0, SFX_CALLMODE_ASYNCHRON );
- break;
- case FN_DELETE_NOTE_AUTHOR:
- case FN_HIDE_NOTE_AUTHOR:
- {
- // not possible as slot as this would require that "this" is the active postit
- SfxStringItem aItem( nSlot, GetAuthor() );
- const SfxPoolItem* aItems[2];
- aItems[0] = &aItem;
- aItems[1] = 0;
- DocView()->GetViewFrame()->GetBindings().Execute( nSlot, aItems, 0, SFX_CALLMODE_ASYNCHRON );
- }
- default:
- mpView->GetViewFrame()->GetBindings().Execute( nSlot );
- break;
- }
-}
-
-bool SwMarginWin::CalcFollow()
-{
- return false;
-}
-
-SwEditWin* SwMarginWin::EditWin()
-{
- return &mpView->GetEditWin();
-}
-
-String SwPostIt::GetAuthor()
-{
- return mpFld->GetPar1();
-}
-
-Date SwPostIt::GetDate()
-{
- return mpFld->GetDate();
-}
-
-Time SwPostIt::GetTime()
-{
- return mpFld->GetTime();
-}
-
-long SwMarginWin::GetPostItTextHeight()
-{
- return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
-}
-
-void SwMarginWin::SwitchToPostIt(USHORT aDirection)
-{
- if (mpMgr)
- {
- SwMarginWin* pPostIt = mpMgr->GetNextPostIt(aDirection, this);
- if (pPostIt)
- pPostIt->GrabFocus();
- }
-}
-
-void SwMarginWin::MouseButtonDown( const MouseEvent& /*rMEvt */)
-{
-}
-
-void SwMarginWin::MouseMove( const MouseEvent& rMEvt )
-{
- if (mRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel())))
- {
- if (!mbMouseOverButton)
- {
- Invalidate(mRectMetaButton);
- mbMouseOverButton = true;
- }
- }
- else
- {
- if (mbMouseOverButton)
- {
- Invalidate(mRectMetaButton);
- mbMouseOverButton = false;
- }
- }
-}
-
-void SwMarginWin::Delete()
-{
- if ( Mgr()->GetActivePostIt() == this)
- {
- Mgr()->SetActivePostIt(0);
- // if the note is empty, the previous line will send a delete event, but we are already there
- if (mnEventId)
- {
- Application::RemoveUserEvent( mnEventId );
- mnEventId = 0;
- }
- }
-}
-
-IMPL_LINK(SwMarginWin, ScrollHdl, ScrollBar*, pScroll)
-{
- long nDiff = View()->GetEditView().GetVisArea().Top() - pScroll->GetThumbPos();
- View()->Scroll( 0, nDiff );
- return 0;
-}
-
-IMPL_LINK(SwMarginWin, ModifyHdl, void*, pVoid)
-{
- // no warnings, please
- pVoid=0;
- DocView()->GetDocShell()->SetModified(sal_True);
- return 0;
-}
-
-IMPL_LINK(SwMarginWin, DeleteHdl, void*, pVoid)
-{
- // no warnings, please
- pVoid=0;
- mnEventId = 0;
- Delete();
- return 0;
-}
-
-
-void SwMarginWin::ResetAttributes()
-{
- mpOutlinerView->RemoveAttribsKeepLanguages(TRUE);
- mpOutliner->RemoveFields(TRUE);
- mpOutlinerView->SetAttribs(DefaultItem());
-}
-
-sal_Int32 SwMarginWin::GetScrollbarWidth()
-{
- return mpView->GetWrtShell().GetViewOptions()->GetZoom() / 10;
-}
-
-sal_Int32 SwMarginWin::GetMetaButtonAreaWidth()
-{
- const Fraction& f( GetMapMode().GetScaleX() );
- if (IsPreview())
- return 3 * METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
- else
- return METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
-}
-
-sal_Int32 SwMarginWin::GetMetaHeight()
-{
- const Fraction& f( GetMapMode().GetScaleY() );
- return POSTIT_META_HEIGHT * f.GetNumerator() / f.GetDenominator();
-}
-
-sal_Int32 SwMarginWin::GetMinimumSizeWithMeta()
-{
- return mpMgr->GetMinimumSizeWithMeta();
-}
-
-sal_Int32 SwMarginWin::GetMinimumSizeWithoutMeta()
-{
- const Fraction& f( GetMapMode().GetScaleY() );
- return POSTIT_MINIMUMSIZE_WITHOUT_META * f.GetNumerator() / f.GetDenominator();
-}
-
-void SwMarginWin::SetSpellChecking()
-{
- const SwViewOption* pVOpt = mpView->GetWrtShellPtr()->GetViewOptions();
- ULONG nCntrl = mpOutliner->GetControlWord();
- if (pVOpt->IsOnlineSpell())
- nCntrl |= EE_CNTRL_ONLINESPELLING;
- else
- nCntrl &= ~EE_CNTRL_ONLINESPELLING;
- mpOutliner->SetControlWord(nCntrl);
-
- mpOutliner->CompleteOnlineSpelling();
- Invalidate();
-}
-
-void SwMarginWin::SetViewState(ShadowState bState)
-{
- switch (bState)
- {
- case SS_EDIT:
- {
- if (mpAnkor)
- {
- mpAnkor->SetAnkorState(AS_ALL);
- SwMarginWin* pWin = GetTopReplyNote();
- if (pWin)
- pWin->Ankor()->SetAnkorState(AS_END);
- mpAnkor->setLineSolid(true);
- }
- if (mpShadow)
- mpShadow->SetShadowState(bState);
- break;
- }
- case SS_VIEW:
- {
- if (mpAnkor)
- mpAnkor->setLineSolid(true);
- if (mpShadow)
- mpShadow->SetShadowState(bState);
- break;
- }
- case SS_NORMAL:
- {
- if (mpAnkor)
- {
- if (IsFollow())
- {
- // if there is no visible parent note, we want to see the complete anchor ??
- //if (IsAnyStackParentVisible())
- mpAnkor->SetAnkorState(AS_END);
- SwMarginWin* pTopWinSelf = GetTopReplyNote();
- SwMarginWin* pTopWinActive = mpMgr->GetActivePostIt() ? mpMgr->GetActivePostIt()->GetTopReplyNote() : 0;
- if (pTopWinSelf && (pTopWinSelf!=pTopWinActive))
- {
- if (pTopWinSelf!=mpMgr->GetActivePostIt())
- pTopWinSelf->Ankor()->setLineSolid(false);
- pTopWinSelf->Ankor()->SetAnkorState(AS_ALL);
- }
- }
- mpAnkor->setLineSolid(false);
- }
- if (mpShadow)
- mpShadow->SetShadowState(bState);
- break;
- }
- }
-}
-
-bool SwMarginWin::IsAnyStackParentVisible()
-{
- SwMarginWin* pMarginWin = mpMgr->GetNextPostIt(KEY_PAGEUP, this);
- while (pMarginWin)
- {
- if (pMarginWin->IsFollow())
- {
- pMarginWin = mpMgr->GetNextPostIt(KEY_PAGEUP, pMarginWin);
- if (pMarginWin && pMarginWin->IsVisible())
- return true;
- }
- else
- return pMarginWin && pMarginWin->IsVisible() ? true : false;
- }
- return false;
-}
-
-SwMarginWin* SwMarginWin::GetTopReplyNote()
-{
- SwMarginWin* pTopNote = 0;
- SwMarginWin* pMarginWin = IsFollow() ? mpMgr->GetNextPostIt(KEY_PAGEUP, this) : 0;
- while (pMarginWin)
- {
- pTopNote = pMarginWin;
- pMarginWin = pMarginWin->IsFollow() ? mpMgr->GetNextPostIt(KEY_PAGEUP, pMarginWin) : 0;
- }
- return pTopNote;
-}
-
-void SwMarginWin::SwitchToFieldPos()
-{
- if ( Mgr()->GetActivePostIt() == this )
- Mgr()->SetActivePostIt(0);
- GotoPos();
- sal_uInt32 aCount = MoveCaret();
- if (aCount)
- DocView()->GetDocShell()->GetWrtShell()->SwCrsrShell::Right(aCount, 0, FALSE);
- GrabFocusToDocument();
-}
-
-String SwMarginWin::GetAuthor()
-{
- return String(EMPTYSTRING);
-}
-
-Date SwMarginWin::GetDate()
-{
- return Date(0);
-}
-
-Time SwMarginWin::GetTime()
-{
- return Time(0);
-}
-
-SvxLanguageItem SwMarginWin::GetLanguage(void)
-{
- return SvxLanguageItem(SwLangHelper::GetLanguage(DocView()->GetWrtShell(),RES_CHRATR_LANGUAGE),RES_CHRATR_LANGUAGE);
-}
-
-/***** SwPostIt *********************************************/
-SwPostIt::SwPostIt( Window* pParent, WinBits nBits, SwFmtFld* aField,SwPostItMgr* aMgr,SwPostItBits aBits)
- : SwMarginWin(pParent,nBits,aMgr,aBits),
- mpFmtFld(aField),
- mpFld( static_cast<SwPostItField*>(aField->GetFld())),
- mStatus(SwPostItHelper::INVISIBLE)
-{
-}
-
-void SwPostIt::SetPostItText()
-{
- // get text from SwPostItField and insert into our textview
- Engine()->SetModifyHdl( Link() );
- Engine()->EnableUndo( FALSE );
- mpFld = static_cast<SwPostItField*>(mpFmtFld->GetFld());
- if( mpFld->GetTextObject() )
- Engine()->SetText( *mpFld->GetTextObject() );
- else
- {
- Engine()->Clear();
- View()->SetAttribs(DefaultItem());
- View()->InsertText(mpFld->GetPar2(),false);
- }
-
- Engine()->ClearModifyFlag();
- Engine()->GetUndoManager().Clear();
- Engine()->EnableUndo( TRUE );
- Engine()->SetModifyHdl( LINK( this, SwPostIt, ModifyHdl ) );
- Invalidate();
-}
-
-void SwPostIt::UpdateData()
-{
- if ( Engine()->IsModified() )
- {
- SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
- SwPosition aPosition( pTxtFld->GetTxtNode() );
- aPosition.nContent = *pTxtFld->GetStart();
- SwField* pOldField = mpFld->Copy();
- mpFld->SetPar2(Engine()->GetEditEngine().GetText());
- mpFld->SetTextObject(Engine()->CreateParaObject());
- DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
- delete pOldField;
- // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one)
- Mgr()->SetLayout();
- // #i98686# if we have several views, all notes should update their text
- mpFmtFld->Broadcast(SwFmtFldHint( 0, SWFMTFLD_CHANGED));
- DocView()->GetDocShell()->SetModified();
- }
- Engine()->ClearModifyFlag();
- Engine()->GetUndoManager().Clear();
-}
-
-void SwPostIt::SetChangeTracking(SwPostItHelper::SwLayoutStatus& aStatus,Color aColor)
-{
- if ( (mStatus != aStatus) || (mChangeColor != aColor) )
- {
- mStatus = aStatus;
- mChangeColor = aColor;
- Invalidate();
- }
-}
-
-void SwPostIt::Delete()
-{
- SwMarginWin::Delete();
- // we delete the field directly, the Mgr cleans up the PostIt by listening
- DocView()->GetWrtShellPtr()->GotoField(*mpFmtFld);
- GrabFocusToDocument();
- DocView()->GetWrtShellPtr()->DelRight();
-}
-
-void SwPostIt::GotoPos()
-{
- DocView()->GetDocShell()->GetWrtShell()->GotoField(*mpFmtFld);
-}
-
-sal_uInt32 SwPostIt::MoveCaret()
-{
- // if this is an answer, do not skip over all following ones, but insert directly behind the current one
- // but when just leaving a note, skip all following ones as well to continue typing
- return Mgr()->IsAnswer() ? 1 : 1 + CountFollowing();
-}
-
-//returns true, if there is another note right before this note
-bool SwPostIt::CalcFollow()
-{
- SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
- SwPosition aPosition( pTxtFld->GetTxtNode() );
- aPosition.nContent = *pTxtFld->GetStart();
- SwTxtAttr * const pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
- aPosition.nContent.GetIndex() - 1, RES_TXTATR_FIELD );
- const SwField* pFld = pTxtAttr ? pTxtAttr->GetFld().GetFld() : 0;
- return pFld && (pFld->Which()== RES_POSTITFLD);
-}
-
-// counts how many SwPostItField we have right after the current one
-sal_uInt32 SwPostIt::CountFollowing()
-{
- sal_uInt32 aCount = 1; // we start with 1, so we have to subtract one at the end again
- SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
- SwPosition aPosition( pTxtFld->GetTxtNode() );
- aPosition.nContent = *pTxtFld->GetStart();
-
- SwTxtAttr * pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
- aPosition.nContent.GetIndex() + 1, RES_TXTATR_FIELD );
- SwField* pFld = pTxtAttr ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld()) : 0;
- while (pFld && (pFld->Which()== RES_POSTITFLD))
- {
- aCount++;
- pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
- aPosition.nContent.GetIndex() + aCount, RES_TXTATR_FIELD );
- pFld = pTxtAttr ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld()) : 0;
- }
- return aCount - 1;
-}
-
-void SwPostIt::MouseButtonDown( const MouseEvent& rMEvt )
-{
- if (mRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel())) && rMEvt.IsLeft())
- {
- if (IsPreview())
- {
- doLazyDelete();
- if (Mgr())
- {
- SwPostIt* pPostIt = dynamic_cast<SwPostIt*>(Mgr()->GetPostIt(mpFmtFld));
- if (pPostIt)
- {
- pPostIt->GrabFocus();
- Mgr()->MakeVisible(pPostIt);
- }
- }
-
- }
- else
- {
- if ( mbReadonly )
- {
- mpButtonPopup->EnableItem(FN_REPLY,false);
- mpButtonPopup->EnableItem(FN_DELETE_NOTE,false);
- mpButtonPopup->EnableItem(FN_DELETE_NOTE_AUTHOR,false);
- mpButtonPopup->EnableItem(FN_DELETE_ALL_NOTES,false);
- }
- else
- {
- if (IsProtected())
- mpButtonPopup->EnableItem(FN_DELETE_NOTE,false);
- else
- mpButtonPopup->EnableItem(FN_DELETE_NOTE,true);
- mpButtonPopup->EnableItem(FN_DELETE_NOTE_AUTHOR,true);
- mpButtonPopup->EnableItem(FN_DELETE_ALL_NOTES,true);
- }
- SvtUserOptions aUserOpt;
- String sAuthor;
- if( !(sAuthor = aUserOpt.GetFullName()).Len())
- if( !(sAuthor = aUserOpt.GetID()).Len() )
- sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
- // do not allow to reply to ourself and no answer possible if this note is in a protected section
- if ((sAuthor == GetAuthor()) || (IsProtected()))
- mpButtonPopup->EnableItem(FN_REPLY,false);
- else
- mpButtonPopup->EnableItem(FN_REPLY,true);
-
- // show the popup menu and execute the selected command
- ExecuteCommand( mpButtonPopup->Execute( this,Rectangle(LogicToPixel(mRectMetaButton.BottomLeft()),LogicToPixel(mRectMetaButton.BottomLeft())),POPUPMENU_EXECUTE_DOWN | POPUPMENU_NOMOUSEUPCLOSE) );
- }
- }
-}
-
-void SwPostIt::SetPopup()
-{
- mpButtonPopup = new PopupMenu(SW_RES(MN_ANNOTATION_BUTTON));
- //mpButtonPopup->SetMenuFlags(MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES);
- XubString aText = mpButtonPopup->GetItemText( FN_DELETE_NOTE_AUTHOR );
- SwRewriter aRewriter;
- aRewriter.AddRule(UNDO_ARG1,GetAuthor());
- aText = aRewriter.Apply(aText);
- mpButtonPopup->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
-}
-
-void SwPostIt::InitAnswer(OutlinerParaObject* pText)
-{
- //collect our old meta data
- SwMarginWin* pWin = Mgr()->GetNextPostIt(KEY_PAGEUP, this);
- const LocaleDataWrapper& rLocalData = SvtSysLocale().GetLocaleData();
- String aText = String(SW_RES(STR_REPLY));
- SwRewriter aRewriter;
- aRewriter.AddRule(UNDO_ARG1, pWin->GetAuthor());
- aText = aRewriter.Apply(aText);
- aText.Append(String(rtl::OUString::createFromAscii(" (") +
- String(rLocalData.getDate( pWin->GetDate())) + rtl::OUString::createFromAscii(", ") +
- String(rLocalData.getTime( pWin->GetTime(),false)) + rtl::OUString::createFromAscii("): \"")));
- View()->InsertText(aText,false);
-
- // insert old, selected text or "..."
- // TOOD: iterate over all paragraphs, not only first one to find out if it is empty
- if (pText->GetTextObject().GetText(0) != String(EMPTYSTRING))
- View()->GetEditView().InsertText(pText->GetTextObject());
- else
- View()->InsertText(rtl::OUString::createFromAscii("..."),false);
- View()->InsertText(rtl::OUString::createFromAscii("\"\n"),false);
-
- View()->SetSelection(ESelection(0x0,0x0,0xFFFF,0xFFFF));
- SfxItemSet aAnswerSet( DocView()->GetDocShell()->GetPool() );
- aAnswerSet.Put(SvxFontHeightItem(200,80,EE_CHAR_FONTHEIGHT));
- aAnswerSet.Put(SvxPostureItem(ITALIC_NORMAL,EE_CHAR_ITALIC));
- View()->SetAttribs(aAnswerSet);
- View()->SetSelection(ESelection(0xFFFF,0xFFFF,0xFFFF,0xFFFF));
-
- //remove all attributes and reset our standard ones
- View()->GetEditView().RemoveAttribsKeepLanguages(true);
- View()->SetAttribs(DefaultItem());
- // lets insert an undo step so the initial text can be easily deleted
- // but do not use UpdateData() directly, would set modified state again and reentrance into Mgr
- Engine()->SetModifyHdl( Link() );
- SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
- SwPosition aPosition( pTxtFld->GetTxtNode() );
- aPosition.nContent = *pTxtFld->GetStart();
- SwField* pOldField = mpFld->Copy();
- mpFld->SetPar2(Engine()->GetEditEngine().GetText());
- mpFld->SetTextObject(Engine()->CreateParaObject());
- DocView()->GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
- delete pOldField;
- Engine()->SetModifyHdl( LINK( this, SwPostIt, ModifyHdl ) );
- Engine()->ClearModifyFlag();
- Engine()->GetUndoManager().Clear();
-}
-
-SvxLanguageItem SwPostIt::GetLanguage(void)
-{
- // set initial language for outliner
- USHORT nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( mpFld->GetLanguage() );
- USHORT nLangWhichId = 0;
- switch (nScriptType)
- {
- case SCRIPTTYPE_LATIN : nLangWhichId = EE_CHAR_LANGUAGE ; break;
- case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
- case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
- default: DBG_ERROR("GetLanguage: wrong script tye");
- }
- return SvxLanguageItem(mpFld->GetLanguage(),nLangWhichId);
-}
-
-bool SwPostIt::IsProtected()
-{
- bool aReturn;
- aReturn = mpFmtFld ? (SwMarginWin::IsProtected() || (mStatus==SwPostItHelper::DELETED) ||
- mpFmtFld->IsProtect()) : (SwMarginWin::IsProtected() || (mStatus==SwPostItHelper::DELETED));
- return aReturn;
-}
-
-/********** SwRedComment**************/
-/*
-SwRedComment::SwRedComment( Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits,SwRedline* pRed)
- : SwMarginWin(pParent,nBits,aMgr,aBits),
- pRedline(pRed)
-{
-}
-
-void SwRedComment::SetPopup()
-{
- mpButtonPopup = new PopupMenu(SW_RES(MN_REDCOMMENT_BUTTON));
- //mpButtonPopup->SetMenuFlags(MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES);
-}
-
-void SwRedComment::UpdateData()
-{
- if ( Engine()->IsModified() )
- {
- // so we get a new layout of notes (ankor position is still the same and we would otherwise not get one)
- Mgr()->SetLayout();
- // SetRedline is calling SetModified already
- DocView()->GetWrtShell().SetRedlineComment(Engine()->GetEditEngine().GetText());
- }
- Engine()->ClearModifyFlag();
- Engine()->GetUndoManager().Clear();
-}
-
-void SwRedComment::SetPostItText()
-{
- Engine()->SetModifyHdl( Link() );
- Engine()->EnableUndo( FALSE );
-
- Engine()->Clear();
- View()->SetAttribs(DefaultItem());
- View()->InsertText(pRedline->GetComment(),false);
-
- Engine()->ClearModifyFlag();
- Engine()->GetUndoManager().Clear();
- Engine()->EnableUndo( TRUE );
- Engine()->SetModifyHdl( LINK( this, SwMarginWin, ModifyHdl ) );
- Invalidate();
-}
-
-void SwRedComment::DeactivatePostIt()
-{
- SwMarginWin::DeactivatePostIt();
- // current Redline is still selected
- DocView()->GetWrtShellPtr()->ClearMark();
-}
-
-void SwRedComment::ActivatePostIt()
-{
- SwMarginWin::ActivatePostIt();
-
- // do we want the redline selected?
- // otherwise, SwRedComment::ActivatePostIt() as well as SwRedComment::DeactivatePostIt()
- // can be thrown out completly
- DocView()->GetDocShell()->GetWrtShell()->GotoRedline(
- DocView()->GetDocShell()->GetWrtShell()->FindRedlineOfData(pRedline->GetRedlineData()),true);
-}
-
-void SwRedComment::MouseButtonDown( const MouseEvent& rMEvt )
-{
- if (mRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel())) && rMEvt.IsLeft())
- {
- ExecuteCommand( mpButtonPopup->Execute( this,Rectangle(LogicToPixel(mRectMetaButton.BottomLeft()),LogicToPixel(mRectMetaButton.BottomLeft())),POPUPMENU_EXECUTE_DOWN | POPUPMENU_NOMOUSEUPCLOSE) );
- }
-}
-
-void SwRedComment::Delete()
-{
- SwMarginWin::Delete();
- // we are not neccessarily on our redline, so let's move there
- GotoPos();
- DocView()->GetWrtShell().SetRedlineComment(EMPTYSTRING);
- DocView()->GetWrtShell().ClearMark();
- // so we get a new layout of notes (ankor position is still the same and we would otherwise not get one)
- Mgr()->SetLayout();
- Mgr()->RemoveItem(pRedline);
-}
-
-void SwRedComment::GotoPos()
-{
- DocView()->GetDocShell()->GetWrtShell()->GotoRedline(
- DocView()->GetDocShell()->GetWrtShell()->FindRedlineOfData(pRedline->GetRedlineData()));
-}
-
-String SwRedComment::GetAuthor()
-{
- return pRedline->GetAuthorString();
-}
-
-Date SwRedComment::GetDate()
-{
- return pRedline->GetTimeStamp().GetDate();
-}
-
-Time SwRedComment::GetTime()
-{
- return pRedline->GetTimeStamp().GetTime();
-}
-
-bool SwRedComment::IsProtected()
-{
- return SwMarginWin::IsProtected() || pRedline->Start()->nNode.GetNode().GetTxtNode()->IsInProtectSect();
-}
-*/
-
-//////////////////////////////////////////////////////////////////////////////
-// helper SwPostItShadowPrimitive
-//
-// Used to allow view-dependent primitive definition. For that purpose, the
-// initially created primitive (this one) always has to be view-independent,
-// but the decomposition is made view-dependent. Very simple primitive which
-// just remembers the discrete data and applies it at decomposition time.
-
-class SwPostItShadowPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D
-{
-private:
- basegfx::B2DPoint maBasePosition;
- basegfx::B2DPoint maSecondPosition;
- ShadowState maShadowState;
-
-protected:
- virtual drawinglayer::primitive2d::Primitive2DSequence create2DDecomposition(
- const drawinglayer::geometry::ViewInformation2D& rViewInformation) const;
-
-public:
- SwPostItShadowPrimitive(
- const basegfx::B2DPoint& rBasePosition,
- const basegfx::B2DPoint& rSecondPosition,
- ShadowState aShadowState)
- : drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D(),
- maBasePosition(rBasePosition),
- maSecondPosition(rSecondPosition),
- maShadowState(aShadowState)
- {}
-
- // data access
- const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
- const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; }
- ShadowState getShadowState() const { return maShadowState; }
-
- virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const;
-
- DeclPrimitrive2DIDBlock()
-};
-
-drawinglayer::primitive2d::Primitive2DSequence SwPostItShadowPrimitive::create2DDecomposition(
- const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const
-{
- // get logic sizes in object coordinate system
- drawinglayer::primitive2d::Primitive2DSequence xRetval;
- basegfx::B2DRange aRange(getBasePosition());
-
- switch(maShadowState)
- {
- case SS_NORMAL:
- {
- aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (2.0 * getDiscreteUnit())));
- const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
- drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
- 0.0,
- 0.5,
- 0.5,
- 1800.0 * F_PI1800,
- basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
- basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
- 2);
-
- const drawinglayer::primitive2d::Primitive2DReference xReference(
- new drawinglayer::primitive2d::FillGradientPrimitive2D(
- aRange,
- aFillGradientAttribute));
-
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- break;
- }
- case SS_VIEW:
- {
- aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit())));
- const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
- drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
- 0.0,
- 0.5,
- 0.5,
- 1800.0 * F_PI1800,
- basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
- basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
- 4);
-
- const drawinglayer::primitive2d::Primitive2DReference xReference(
- new drawinglayer::primitive2d::FillGradientPrimitive2D(
- aRange,
- aFillGradientAttribute));
-
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- break;
- }
- case SS_EDIT:
- {
- aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit())));
- const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
- drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
- 0.0,
- 0.5,
- 0.5,
- 1800.0 * F_PI1800,
- basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
- basegfx::BColor(83.0/255.0,83.0/255.0,83.0/255.0),
- 4);
-
- const drawinglayer::primitive2d::Primitive2DReference xReference(
- new drawinglayer::primitive2d::FillGradientPrimitive2D(
- aRange,
- aFillGradientAttribute));
-
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- break;
- }
- default:
- {
- break;
- }
- }
-
- return xRetval;
-}
-
-bool SwPostItShadowPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const
-{
- if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
- {
- const SwPostItShadowPrimitive& rCompare = static_cast< const SwPostItShadowPrimitive& >(rPrimitive);
-
- return (getBasePosition() == rCompare.getBasePosition()
- && getSecondPosition() == rCompare.getSecondPosition()
- && getShadowState() == rCompare.getShadowState());
- }
-
- return false;
-}
-
-ImplPrimitrive2DIDBlock(SwPostItShadowPrimitive, PRIMITIVE2D_ID_SWPOSTITSHADOWPRIMITIVE)
-
-/****** SwPostItShadow ***********************************************************/
-SwPostItShadow::SwPostItShadow(const basegfx::B2DPoint& rBasePos,const basegfx::B2DPoint& rSecondPosition,
- Color aBaseColor,ShadowState aState)
- : OverlayObjectWithBasePosition(rBasePos, aBaseColor),
- maSecondPosition(rSecondPosition),
- mShadowState(aState)
-{
-// mbAllowsAnimation = false;
-}
-
-SwPostItShadow::~SwPostItShadow()
-{
-}
-
-drawinglayer::primitive2d::Primitive2DSequence SwPostItShadow::createOverlayObjectPrimitive2DSequence()
-{
- const drawinglayer::primitive2d::Primitive2DReference aReference(
- new SwPostItShadowPrimitive(
- getBasePosition(),
- GetSecondPosition(),
- GetShadowState()));
- return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
-}
-
-void SwPostItShadow::SetShadowState(ShadowState aState)
-{
- if (mShadowState != aState)
- {
- mShadowState = aState;
-
- objectChange();
- }
-}
-
-void SwPostItShadow::SetPosition(const basegfx::B2DPoint& rPoint1,
- const basegfx::B2DPoint& rPoint2)
-{
- if(!rPoint1.equal(getBasePosition()) || !rPoint2.equal(GetSecondPosition()))
- {
- maBasePosition = rPoint1;
- maSecondPosition = rPoint2;
-
- objectChange();
- }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-// helper class: Primitive for discrete visualisation
-
-class SwPostItAnkorPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D
-{
-private:
- basegfx::B2DPolygon maTriangle;
- basegfx::B2DPolygon maLine;
- basegfx::B2DPolygon maLineTop;
- AnkorState maAnkorState;
- basegfx::BColor maColor;
-
- // discrete line width
- double mfLogicLineWidth;
-
- // bitfield
- bool mbShadow : 1;
- bool mbLineSolid : 1;
-
-protected:
- virtual drawinglayer::primitive2d::Primitive2DSequence create2DDecomposition(
- const drawinglayer::geometry::ViewInformation2D& rViewInformation) const;
-
-public:
- SwPostItAnkorPrimitive(
- const basegfx::B2DPolygon& rTriangle,
- const basegfx::B2DPolygon& rLine,
- const basegfx::B2DPolygon& rLineTop,
- AnkorState aAnkorState,
- const basegfx::BColor& rColor,
- double fLogicLineWidth,
- bool bShadow,
- bool bLineSolid)
- : drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D(),
- maTriangle(rTriangle),
- maLine(rLine),
- maLineTop(rLineTop),
- maAnkorState(aAnkorState),
- maColor(rColor),
- mfLogicLineWidth(fLogicLineWidth),
- mbShadow(bShadow),
- mbLineSolid(bLineSolid)
- {}
-
- // data access
- const basegfx::B2DPolygon& getTriangle() const { return maTriangle; }
- const basegfx::B2DPolygon& getLine() const { return maLine; }
- const basegfx::B2DPolygon& getLineTop() const { return maLineTop; }
- AnkorState getAnkorState() const { return maAnkorState; }
- const basegfx::BColor& getColor() const { return maColor; }
- double getLogicLineWidth() const { return mfLogicLineWidth; }
- bool getShadow() const { return mbShadow; }
- bool getLineSolid() const { return mbLineSolid; }
-
- virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const;
-
- DeclPrimitrive2DIDBlock()
-};
-
-drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkorPrimitive::create2DDecomposition(
- const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const
-{
- drawinglayer::primitive2d::Primitive2DSequence aRetval;
-
- if(AS_TRI == getAnkorState() || AS_ALL == getAnkorState() || AS_START == getAnkorState())
- {
- // create triangle
- const drawinglayer::primitive2d::Primitive2DReference aTriangle(
- new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
- basegfx::B2DPolyPolygon(getTriangle()),
- getColor()));
-
- drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aTriangle);
- }
-
- if(AS_ALL == getAnkorState() || AS_START == getAnkorState())
- {
- // create line start
- const drawinglayer::attribute::LineAttribute aLineAttribute(
- getColor(),
- getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit()));
-
- if(getLineSolid())
- {
- const drawinglayer::primitive2d::Primitive2DReference aSolidLine(
- new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
- getLine(),
- aLineAttribute));
-
- drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aSolidLine);
- }
- else
- {
- ::std::vector< double > aDotDashArray;
- const double fDistance(3.0 * 15.0);
- const double fDashLen(5.0 * 15.0);
-
- aDotDashArray.push_back(fDashLen);
- aDotDashArray.push_back(fDistance);
-
- const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(
- aDotDashArray,
- fDistance + fDashLen);
-
- const drawinglayer::primitive2d::Primitive2DReference aStrokedLine(
- new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
- getLine(),
- aLineAttribute,
- aStrokeAttribute));
-
- drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aStrokedLine);
- }
- }
-
- if(aRetval.hasElements() && getShadow())
- {
- // shadow is only for triangle and line start, and in upper left
- // and lower right direction, in different colors
- const double fColorChange(20.0 / 255.0);
- const basegfx::B3DTuple aColorChange(fColorChange, fColorChange, fColorChange);
- basegfx::BColor aLighterColor(getColor() + aColorChange);
- basegfx::BColor aDarkerColor(getColor() - aColorChange);
-
- aLighterColor.clamp();
- aDarkerColor.clamp();
-
- // create shadow sequence
- drawinglayer::primitive2d::Primitive2DSequence aShadows(2);
- basegfx::B2DHomMatrix aTransform;
-
- aTransform.set(0, 2, -getDiscreteUnit());
- aTransform.set(1, 2, -getDiscreteUnit());
-
- aShadows[0] = drawinglayer::primitive2d::Primitive2DReference(
- new drawinglayer::primitive2d::ShadowPrimitive2D(
- aTransform,
- aLighterColor,
- aRetval));
-
- aTransform.set(0, 2, getDiscreteUnit());
- aTransform.set(1, 2, getDiscreteUnit());
-
- aShadows[1] = drawinglayer::primitive2d::Primitive2DReference(
- new drawinglayer::primitive2d::ShadowPrimitive2D(
- aTransform,
- aDarkerColor,
- aRetval));
-
- // add shadow before geometry to make it be proccessed first
- const drawinglayer::primitive2d::Primitive2DSequence aTemporary(aRetval);
-
- aRetval = aShadows;
- drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemporary);
- }
-
- if(AS_ALL == getAnkorState() || AS_END == getAnkorState())
- {
- // LineTop has to be created, too, but uses no shadow, so add after
- // the other parts are created
- const drawinglayer::attribute::LineAttribute aLineAttribute(
- getColor(),
- getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit()));
-
- const drawinglayer::primitive2d::Primitive2DReference aLineTop(
- new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
- getLineTop(),
- aLineAttribute));
-
- drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aLineTop);
- }
-
- return aRetval;
-}
-
-bool SwPostItAnkorPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const
-{
- if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
- {
- const SwPostItAnkorPrimitive& rCompare = static_cast< const SwPostItAnkorPrimitive& >(rPrimitive);
-
- return (getTriangle() == rCompare.getTriangle()
- && getLine() == rCompare.getLine()
- && getLineTop() == rCompare.getLineTop()
- && getAnkorState() == rCompare.getAnkorState()
- && getColor() == rCompare.getColor()
- && getLogicLineWidth() == rCompare.getLogicLineWidth()
- && getShadow() == rCompare.getShadow()
- && getLineSolid() == rCompare.getLineSolid());
- }
-
- return false;
-}
-
-ImplPrimitrive2DIDBlock(SwPostItAnkorPrimitive, PRIMITIVE2D_ID_SWPOSTITANKORPRIMITIVE)
-
-/****** SwPostItAnkor ***********************************************************/
-
-void SwPostItAnkor::implEnsureGeometry()
-{
- if(!maTriangle.count())
- {
- maTriangle.append(getBasePosition());
- maTriangle.append(GetSecondPosition());
- maTriangle.append(GetThirdPosition());
- maTriangle.setClosed(true);
- }
-
- if(!maLine.count())
- {
- maLine.append(GetFourthPosition());
- maLine.append(GetFifthPosition());
- maLine.append(GetSixthPosition());
- }
-
- if(!maLineTop.count())
- {
- maLineTop.append(GetSixthPosition());
- maLineTop.append(GetSeventhPosition());
- }
-}
-
-void SwPostItAnkor::implResetGeometry()
-{
- maTriangle.clear();
- maLine.clear();
- maLineTop.clear();
-}
-
-SwPostItAnkor::SwPostItAnkor(const basegfx::B2DPoint& rBasePos,
- const basegfx::B2DPoint& rSecondPos,
- const basegfx::B2DPoint& rThirdPos,
- const basegfx::B2DPoint& rFourthPos,
- const basegfx::B2DPoint& rFifthPos,
- const basegfx::B2DPoint& rSixthPos,
- const basegfx::B2DPoint& rSeventhPos,
- Color aBaseColor,
- bool bShadowedEffect,
- bool bLineSolid)
- : OverlayObjectWithBasePosition(rBasePos, aBaseColor),
- maSecondPosition(rSecondPos),
- maThirdPosition(rThirdPos),
- maFourthPosition(rFourthPos),
- maFifthPosition(rFifthPos),
- maSixthPosition(rSixthPos),
- maSeventhPosition(rSeventhPos),
- maTriangle(),
- maLine(),
- maLineTop(),
- mHeight(0),
- mAnkorState(AS_ALL),
- mbShadowedEffect(bShadowedEffect),
- mbLineSolid(bLineSolid)
-{
- //mbAllowsAnimation = true;
-}
-
-SwPostItAnkor::~SwPostItAnkor()
-{
-}
-
-drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkor::createOverlayObjectPrimitive2DSequence()
-{
- implEnsureGeometry();
-
- const drawinglayer::primitive2d::Primitive2DReference aReference(
- new SwPostItAnkorPrimitive(
- maTriangle,
- maLine,
- maLineTop,
- GetAnkorState(),
- getBaseColor().getBColor(),
- ANKORLINE_WIDTH * 15.0,
- getShadowedEffect(),
- getLineSolid()));
-
- return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
-}
-
-void SwPostItAnkor::SetAllPosition(const basegfx::B2DPoint& rPoint1,
- const basegfx::B2DPoint& rPoint2,
- const basegfx::B2DPoint& rPoint3,
- const basegfx::B2DPoint& rPoint4,
- const basegfx::B2DPoint& rPoint5,
- const basegfx::B2DPoint& rPoint6,
- const basegfx::B2DPoint& rPoint7)
-{
- if(rPoint1 != getBasePosition()
- || rPoint2 != GetSecondPosition()
- || rPoint3 != GetThirdPosition()
- || rPoint4 != GetFourthPosition()
- || rPoint5 != GetFifthPosition()
- || rPoint6 != GetSixthPosition()
- || rPoint7 != GetSeventhPosition())
- {
- maBasePosition = rPoint1;
- maSecondPosition = rPoint2;
- maThirdPosition = rPoint3;
- maFourthPosition = rPoint4;
- maFifthPosition = rPoint5;
- maSixthPosition = rPoint6;
- maSeventhPosition = rPoint7;
-
- implResetGeometry();
- objectChange();
- }
-}
-
-void SwPostItAnkor::SetSixthPosition(const basegfx::B2DPoint& rNew)
-{
- if(rNew != maSixthPosition)
- {
- maSixthPosition = rNew;
- implResetGeometry();
- objectChange();
- }
-}
-
-void SwPostItAnkor::SetSeventhPosition(const basegfx::B2DPoint& rNew)
-{
- if(rNew != maSeventhPosition)
- {
- maSeventhPosition = rNew;
- implResetGeometry();
- objectChange();
- }
-}
-
-void SwPostItAnkor::SetTriPosition(const basegfx::B2DPoint& rPoint1,const basegfx::B2DPoint& rPoint2,const basegfx::B2DPoint& rPoint3,
- const basegfx::B2DPoint& rPoint4,const basegfx::B2DPoint& rPoint5)
-{
- if(rPoint1 != getBasePosition()
- || rPoint2 != GetSecondPosition()
- || rPoint3 != GetThirdPosition()
- || rPoint4 != GetFourthPosition()
- || rPoint5 != GetFifthPosition())
- {
- maBasePosition = rPoint1;
- maSecondPosition = rPoint2;
- maThirdPosition = rPoint3;
- maFourthPosition = rPoint4;
- maFifthPosition = rPoint5;
-
- implResetGeometry();
- objectChange();
- }
-}
-
-void SwPostItAnkor::setLineSolid(bool bNew)
-{
- if(bNew != getLineSolid())
- {
- mbLineSolid = bNew;
- objectChange();
- }
-}
-
-void SwPostItAnkor::SetAnkorState(AnkorState aState)
-{
- if (mAnkorState != aState)
- {
- mAnkorState = aState;
- objectChange();
- }
-}
diff --git a/sw/source/ui/docvw/romenu.cxx b/sw/source/ui/docvw/romenu.cxx
index 0e3ab86c71a7..f793a7f854b7 100644
--- a/sw/source/ui/docvw/romenu.cxx
+++ b/sw/source/ui/docvw/romenu.cxx
@@ -214,7 +214,7 @@ SwReadOnlyPopup::SwReadOnlyPopup( const Point &rDPos, SwView &rV ) :
else
EnableItem( MN_READONLY_LOADGRAPHIC, FALSE );
- BOOL bReloadFrame = 0 != rSh.GetView().GetViewFrame()->GetFrame()->GetParentFrame();
+ BOOL bReloadFrame = 0 != rSh.GetView().GetViewFrame()->GetFrame().GetParentFrame();
EnableItem( MN_READONLY_RELOAD_FRAME,
bReloadFrame );
EnableItem( MN_READONLY_RELOAD, !bReloadFrame);
@@ -222,7 +222,6 @@ SwReadOnlyPopup::SwReadOnlyPopup( const Point &rDPos, SwView &rV ) :
Check( MN_READONLY_EDITDOC, SID_EDITDOC, rDis );
Check( MN_READONLY_SELECTION_MODE, FN_READONLY_SELECTION_MODE, rDis );
Check( MN_READONLY_SOURCEVIEW, SID_SOURCEVIEW, rDis );
- Check( MN_READONLY_BROWSE_STOP, SID_BROWSE_STOP, rDis );
Check( MN_READONLY_BROWSE_BACKWARD, SID_BROWSE_BACKWARD,rDis );
Check( MN_READONLY_BROWSE_FORWARD, SID_BROWSE_FORWARD, rDis );
#ifdef WNT
@@ -314,7 +313,6 @@ void SwReadOnlyPopup::Execute( Window* pWin, USHORT nId )
rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(SID_RELOAD);
break;
- case MN_READONLY_BROWSE_STOP: nExecId = SID_BROWSE_STOP; break;
case MN_READONLY_BROWSE_BACKWARD: nExecId = SID_BROWSE_BACKWARD;break;
case MN_READONLY_BROWSE_FORWARD: nExecId = SID_BROWSE_FORWARD; break;
case MN_READONLY_SOURCEVIEW: nExecId = SID_SOURCEVIEW; break;
diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx
index ae553ee89a19..141adf35ddf0 100644
--- a/sw/source/ui/envelp/mailmrge.cxx
+++ b/sw/source/ui/envelp/mailmrge.cxx
@@ -65,7 +65,7 @@
#include <com/sun/star/sdbc/XDataSource.hpp>
#include <toolkit/unohlp.hxx>
#include <comphelper/processfactory.hxx>
-#include <com/sun/star/form/XFormController.hpp>
+#include <com/sun/star/form/runtime/XFormController.hpp>
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/container/XContainerQuery.hpp>
@@ -96,7 +96,7 @@ using namespace ::com::sun::star::ui::dialogs;
---------------------------------------------------------------------------*/
struct SwMailMergeDlg_Impl
{
- uno::Reference<XFormController> xFController;
+ uno::Reference<runtime::XFormController> xFController;
uno::Reference<XSelectionChangeListener> xChgLstnr;
uno::Reference<XSelectionSupplier> xSelSupp;
};
@@ -329,7 +329,7 @@ SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell,
pBeamerWin->Show();
}
uno::Reference<XController> xController = xFrame->getController();
- pImpl->xFController = uno::Reference<XFormController>(xController, UNO_QUERY);
+ pImpl->xFController = uno::Reference<runtime::XFormController>(xController, UNO_QUERY);
if(pImpl->xFController.is())
{
uno::Reference< awt::XControl > xCtrl = pImpl->xFController->getCurrentControl( );
diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx
index 47c97f34ce99..2c354551f1f3 100644
--- a/sw/source/ui/fldui/fldedt.cxx
+++ b/sw/source/ui/fldui/fldedt.cxx
@@ -407,7 +407,7 @@ IMPL_LINK( SwFldEditDlg, AddressHdl, PushButton *, EMPTYARG )
DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aSet,
- pSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(),
+ pSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(),
RC_DLG_ADDR );
DBG_ASSERT(pDlg, "Dialogdiet fail!");
if(RET_OK == pDlg->Execute())
diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index 6f62f65c6b87..c78f51f4796f 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -567,7 +567,7 @@ void SwTemplateDlg::PageCreated( USHORT nId, SfxTabPage &rPage )
SfxAllItemSet aNewSet(*aSet.GetPool());
aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) );
if ( pWrtShell )
- rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame()->GetFrameInterface() );
+ rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
rPage.PageCreated(aNewSet);
break;
}
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index eb067cc61c71..0a3c8cc33623 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -354,7 +354,8 @@ IMPL_LINK(SwColumnDlg, OkHdl, OKButton*, EMPTYARG)
const SwSection* pCurrSection = rWrtShell.GetCurrSection();
const SwSectionFmt* pFmt = pCurrSection->GetFmt();
USHORT nNewPos = rWrtShell.GetSectionFmtPos( *pFmt );
- rWrtShell.ChgSection( nNewPos, *pCurrSection, pSectionSet );
+ SwSectionData aData(*pCurrSection);
+ rWrtShell.UpdateSection( nNewPos, aData, pSectionSet );
}
if(pSectionSet && pSectionSet->Count() && bSelSectionChanged )
diff --git a/sw/source/ui/frmdlg/frmdlg.cxx b/sw/source/ui/frmdlg/frmdlg.cxx
index 42b1fb1bed5f..740d31c5e88c 100644
--- a/sw/source/ui/frmdlg/frmdlg.cxx
+++ b/sw/source/ui/frmdlg/frmdlg.cxx
@@ -193,7 +193,7 @@ void SwFrmDlg::PageCreated( USHORT nId, SfxTabPage &rPage )
aNewSet.Put( SwMacroAssignDlg::AddEvents(
DLG_FRM_GRF == m_nDlgType ? MACASSGN_GRAPHIC : DLG_FRM_OLE == m_nDlgType ? MACASSGN_OLE : MACASSGN_FRMURL ) );
if ( m_pWrtShell )
- rPage.SetFrame( m_pWrtShell->GetView().GetViewFrame()->GetFrame()->GetFrameInterface() );
+ rPage.SetFrame( m_pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
rPage.PageCreated(aNewSet);
break;
}
diff --git a/sw/source/ui/inc/SidebarWindowsConsts.hxx b/sw/source/ui/inc/SidebarWindowsConsts.hxx
new file mode 100644
index 000000000000..378b2be0790a
--- /dev/null
+++ b/sw/source/ui/inc/SidebarWindowsConsts.hxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SIDEBARWINDOWSCONSTS_HXX
+#define _SIDEBARWINDOWSCONSTS_HXX
+
+namespace sw { namespace sidebarwindows {
+
+const sal_Int8 ANCHORLINE_WIDTH = 1;
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/inc/regionsw.hxx b/sw/source/ui/inc/regionsw.hxx
index 40ba9d3d0a15..0237f560da09 100644
--- a/sw/source/ui/inc/regionsw.hxx
+++ b/sw/source/ui/inc/regionsw.hxx
@@ -61,91 +61,11 @@ namespace sfx2
class FileDialogHelper;
}
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-
-class SectRepr
-{
- SwSection aSection;
- SwFmtCol aCol;
- SvxBrushItem aBrush;
- SwFmtFtnAtTxtEnd aFtnNtAtEnd;
- SwFmtEndAtTxtEnd aEndNtAtEnd;
- SwFmtNoBalancedColumns aBalance;
- SvxFrameDirectionItem aFrmDirItem;
- SvxLRSpaceItem aLRSpaceItem;
- USHORT nArrPos;
- USHORT nColumn;
- BOOL bContent : 1; //zeigt an, ob evtl. Textinhalt im Bereich ist
- BOOL bSelected : 1; //fuer Multiselektion erst markieren, dann mit der TreeListBox arbeiten!
- ::com::sun::star::uno::Sequence <sal_Int8 > aTempPasswd;
-public:
- SectRepr(USHORT nPos, SwSection& rSect);
- BOOL operator ==(SectRepr& rSectRef) const
- {return nArrPos==rSectRef.GetArrPos();}
-
- BOOL operator <(SectRepr& rSectRef) const
- {return nArrPos<rSectRef.GetArrPos();}
-
- SwSection& GetSection() { return aSection; }
- SwFmtCol& GetCol() { return aCol; }
- SvxBrushItem& GetBackground() { return aBrush; }
- SwFmtFtnAtTxtEnd& GetFtnNtAtEnd() { return aFtnNtAtEnd; }
- SwFmtEndAtTxtEnd& GetEndNtAtEnd() { return aEndNtAtEnd; }
- SwFmtNoBalancedColumns& GetBalance() { return aBalance; }
- SvxFrameDirectionItem& GetFrmDir() { return aFrmDirItem; }
- SvxLRSpaceItem& GetLRSpace() { return aLRSpaceItem; }
-
- USHORT GetArrPos() const {return nArrPos;}
- const String& GetCondition() const {return aSection.GetCondition();}
- const String& GetName() const { return aSection.GetName(); }
- String GetFile() const;
- String GetSubRegion() const;
- void SetFile( const String& rFile );
- void SetFilter( const String& rFilter );
- void SetSubRegion( const String& rSubRegion );
-
- void SetFilePasswd( const String& rPasswd )
- { aSection.SetLinkFilePassWd( rPasswd ); }
- void SetCondition( const String& rString )
- {aSection.SetCondition( rString);}
- BOOL IsCondHidden()const
- {return aSection.IsCondHidden();}
- BOOL IsHidden()const
- {return aSection.IsHidden();}
- BOOL IsProtect()const
- {return aSection.IsProtect();}
- // --> FME 2004-06-22 #114856# edit in readonly sections
- BOOL IsEditInReadonly()const
- {return aSection.IsEditInReadonly();}
- void SetEditInReadonly(BOOL bFlag = TRUE)
- {aSection.SetEditInReadonly(bFlag);}
- // <--
- void SetHidden(BOOL bFlag = TRUE)
- {aSection.SetHidden(bFlag);}
- void SetCondHidden(BOOL bFlag = TRUE)
- {aSection.SetCondHidden(bFlag);}
- void SetProtect(BOOL bFlag = TRUE)
- {aSection.SetProtect(bFlag);}
- BOOL IsContent(){return bContent;}
- void SetContent(BOOL bValue){bContent = bValue;}
- void SetSectionType(SectionType eSectionType) {aSection.SetType(eSectionType);}
- SectionType GetSectionType(){return aSection.GetType();}
-
- void SetSelected(){bSelected = TRUE;}
- BOOL IsSelected() const {return bSelected;}
-
-
- const ::com::sun::star::uno::Sequence <sal_Int8 >& GetPasswd() const {return aSection.GetPasswd();}
- ::com::sun::star::uno::Sequence <sal_Int8 >& GetTempPasswd() {return aTempPasswd;}
- void SetTempPasswd(const ::com::sun::star::uno::Sequence <sal_Int8 >& aPasswd) {aTempPasswd = aPasswd;}
-};
-
/*************************************************************************
Dialog "Bereiche bearbeiten"
*************************************************************************/
+class SectRepr;
typedef SectRepr* SectReprPtr;
SV_DECL_PTRARR_SORT( SectReprArr, SectReprPtr, 0, 4 )
@@ -385,7 +305,8 @@ public:
class SwInsertSectionTabDialog : public SfxTabDialog
{
SwWrtShell& rWrtSh;
- SwSection* pToInsertSection;
+ ::std::auto_ptr<SwSectionData> m_pSectionData;
+
protected:
virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
virtual short Ok();
@@ -393,8 +314,8 @@ public:
SwInsertSectionTabDialog(Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh);
virtual ~SwInsertSectionTabDialog();
- void SetSection(const SwSection& rSect);
- SwSection* GetSection() { return pToInsertSection;}
+ void SetSectionData(SwSectionData const& rSect);
+ SwSectionData * GetSectionData() { return m_pSectionData.get(); }
};
/* -----------------21.05.99 13:07-------------------
diff --git a/sw/source/ui/inc/swmn_tmpl.hrc b/sw/source/ui/inc/swmn_tmpl.hrc
index 3128f741be30..bf375e4ab010 100644
--- a/sw/source/ui/inc/swmn_tmpl.hrc
+++ b/sw/source/ui/inc/swmn_tmpl.hrc
@@ -131,7 +131,6 @@
HelpID = MN_FORMAT_ALGN ; \
Command = ".uno:AlignTextMenu" ; \
Text [ en-US ] = "A~lignment" ; \
- RadioCheck = TRUE ; \
SubMenu = Menu\
{\
ItemList = \
diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx
index 2a65e1b36ff7..2fce41b1a972 100644
--- a/sw/source/ui/inc/wrtsh.hxx
+++ b/sw/source/ui/inc/wrtsh.hxx
@@ -47,7 +47,7 @@ class SdrView;
class SwView;
class SvGlobalName;
class SwInputFieldList;
-class SwSection;
+class SwSectionData;
class Timer;
class SvxMacro;
class SwFmtINetFmt;
@@ -460,7 +460,7 @@ typedef BOOL (SwWrtShell:: *FNSimpleMove)();
void AutoUpdatePara(SwTxtFmtColl* pColl, const SfxItemSet& rStyleSet);
// Link fuers einfuegen von Bereichen uebers Drag&Drop/Clipboard
- DECL_STATIC_LINK( SwWrtShell, InsertRegionDialog, SwSection* );
+ DECL_STATIC_LINK( SwWrtShell, InsertRegionDialog, SwSectionData* );
//ctoren, der erstere ist eine Art kontrollierter copy ctor fuer weitere
diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx
index 351999015711..9ebfd8c8cf36 100644
--- a/sw/source/ui/lingu/olmenu.cxx
+++ b/sw/source/ui/lingu/olmenu.cxx
@@ -275,7 +275,7 @@ USHORT SwSpellPopup::fillLangPopupMenu(
//6--all languages used in current document
uno::Reference< com::sun::star::frame::XModel > xModel;
- uno::Reference< com::sun::star::frame::XController > xController( pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface()->getController(), uno::UNO_QUERY );
+ uno::Reference< com::sun::star::frame::XController > xController( pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface()->getController(), uno::UNO_QUERY );
if ( xController.is() )
xModel = xController->getModel();
@@ -307,6 +307,9 @@ USHORT SwSpellPopup::fillLangPopupMenu(
}
}
+ bool bMultipleLanguages = (nLangTable != 0) || (curLang.compareToAscii( "*" ) == 0);
+ bool bNothingSelected = true;
+ MenuItemBits nMenuItemStyle = !bMultipleLanguages ? MIB_RADIOCHECK : 0;
for (std::map< rtl::OUString, rtl::OUString >::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it)
{
rtl::OUString aEntryTxt( it->first );
@@ -322,22 +325,25 @@ USHORT SwSpellPopup::fillLangPopupMenu(
else if (nLangTable == 2) // language for document
aLangTable_Document[nItemId] = aEntryTxt;
- pPopupMenu->InsertItem( nItemId, aEntryTxt, MIB_RADIOCHECK );
- if (aEntryTxt == curLang)
+ pPopupMenu->InsertItem( nItemId, aEntryTxt, nMenuItemStyle );
+ if ((nLangTable == 0) && (aEntryTxt == curLang))
{
//make a check mark for the current language
pPopupMenu->CheckItem( nItemId, TRUE );
+ bNothingSelected = false;
}
}
}
//7--none
nItemId++;
- pPopupMenu->InsertItem( nItemId, String(SW_RES( STR_LANGSTATUS_NONE )), MIB_RADIOCHECK );
+ pPopupMenu->InsertItem( nItemId, String(SW_RES( STR_LANGSTATUS_NONE )), nMenuItemStyle );
+ if (bNothingSelected && !bMultipleLanguages)
+ pPopupMenu->CheckItem( nItemId, TRUE );
//More...
nItemId++;
- pPopupMenu->InsertItem( nItemId, String(SW_RES( STR_LANGSTATUS_MORE )), MIB_RADIOCHECK );
+ pPopupMenu->InsertItem( nItemId, String(SW_RES( STR_LANGSTATUS_MORE )) );
return nItemId - Lang_Start; // return number of inserted entries
}
@@ -576,7 +582,7 @@ bGrammarResults(false)
nNumLanguageDocEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, 2 );
EnableItem( MN_LANGUAGE_ALL_TEXT, true );
*/
- uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface();
+ uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface();
Image rImg = ::GetImage( xFrame,
::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False,
Application::GetSettings().GetStyleSettings().GetHighContrastMode() );
@@ -710,7 +716,7 @@ aInfo16( SW_RES(IMG_INFO_16) )
nNumLanguageDocEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, 2 );
EnableItem( MN_LANGUAGE_ALL_TEXT, true );
*/
- uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface();
+ uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface();
Image rImg = ::GetImage( xFrame,
::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False,
Application::GetSettings().GetStyleSettings().GetHighContrastMode() );
diff --git a/sw/source/ui/makefile.mk b/sw/source/ui/makefile.mk
index fa1dea2bac5c..b331a2a00765 100644
--- a/sw/source/ui/makefile.mk
+++ b/sw/source/ui/makefile.mk
@@ -58,8 +58,8 @@ SUBLIBS1= \
$(SLB)$/dbui.lib \
$(SLB)$/dialog.lib \
$(SLB)$/dochdl.lib \
- $(SLB)$/docvw.lib \
- $(SLB)$/envelp.lib \
+ $(SLB)$/docvw.lib \
+ $(SLB)$/envelp.lib \
$(SLB)$/fldui.lib \
$(SLB)$/frmdlg.lib \
$(SLB)$/globdoc.lib
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index fe6950ef4722..a2b6b85a7449 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -638,7 +638,7 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn )
const SfxPoolItem* pItem;
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( this, aSet,
- pSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), SID_EVENTCONFIG );
+ pSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(), SID_EVENTCONFIG );
if ( pMacroDlg && pMacroDlg->Execute() == RET_OK &&
SFX_ITEM_SET == pMacroDlg->GetOutputItemSet()->GetItemState( RES_FRMMACRO, sal_False, &pItem ) )
{
diff --git a/sw/source/ui/misc/glshell.cxx b/sw/source/ui/misc/glshell.cxx
index b3011985bbc0..4d93f8d7542f 100644
--- a/sw/source/ui/misc/glshell.cxx
+++ b/sw/source/ui/misc/glshell.cxx
@@ -306,7 +306,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rS
}
// Dokumenttitel setzen
- SfxViewFrame* pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, nViewId, !bShow );
+ SfxViewFrame* pFrame = bShow ? SfxViewFrame::LoadDocument( *xDocSh, nViewId ) : SfxViewFrame::LoadHiddenDocument( *xDocSh, nViewId );
String aDocTitle(SW_RES( STR_GLOSSARY ));
aDocTitle += ' ';
aDocTitle += sLongName;
@@ -343,7 +343,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rS
xDocSh->GetDoc()->DoUndo( bDoesUndo );
xDocSh->GetDoc()->ResetModified();
if ( bShow )
- pFrame->GetFrame()->Appear();
+ pFrame->GetFrame().Appear();
delete pGroup;
}
diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx
index b67981018015..5cc82f8473eb 100644
--- a/sw/source/ui/misc/insfnote.cxx
+++ b/sw/source/ui/misc/insfnote.cxx
@@ -173,7 +173,7 @@ IMPL_LINK( SwInsFootNoteDlg, NumberExtCharHdl, Button *, EMPTYARG )
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aAllSet,
- rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP );
+ rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
if (RET_OK == pDlg->Execute())
{
SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pItem, SfxStringItem, SID_CHARMAP, FALSE );
diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx
index f03a6de204d9..be7622319626 100644
--- a/sw/source/ui/misc/srtdlg.cxx
+++ b/sw/source/ui/misc/srtdlg.cxx
@@ -393,7 +393,7 @@ IMPL_LINK( SwSortDlg, DelimCharHdl, PushButton*, EMPTYARG )
SfxAllItemSet aSet( rSh.GetAttrPool() );
aSet.Put( SfxInt32Item( SID_ATTR_CHAR, GetDelimChar() ) );
SfxAbstractDialog* pMap = pFact->CreateSfxDialog( &aDelimPB, aSet,
- rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP );
+ rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
if( RET_OK == pMap->Execute() )
{
SFX_ITEMSET_ARG( pMap->GetOutputItemSet(), pItem, SfxInt32Item, SID_ATTR_CHAR, FALSE );
diff --git a/sw/source/ui/ribbar/tblctrl.cxx b/sw/source/ui/ribbar/tblctrl.cxx
index 5c214950f4bc..ad5046af6b42 100644
--- a/sw/source/ui/ribbar/tblctrl.cxx
+++ b/sw/source/ui/ribbar/tblctrl.cxx
@@ -36,7 +36,6 @@
#include "cmdid.h"
#include "swtypes.hxx"
-#include "tbxmgr.hxx"
#include "tblctrl.hxx"
#include "tblctrl.hrc"
diff --git a/sw/source/ui/ribbar/tbxmgr.cxx b/sw/source/ui/ribbar/tbxmgr.cxx
deleted file mode 100644
index cbef12105242..000000000000
--- a/sw/source/ui/ribbar/tbxmgr.cxx
+++ /dev/null
@@ -1,180 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sw.hxx"
-
-
-
-#include "cmdid.h"
-#include "swtypes.hxx" // nur wegen aEmptyString??
-#include "errhdl.hxx"
-#include "wdocsh.hxx"
-#include "tbxmgr.hxx"
-
-
-/*************************************************************************
-|*
-|*
-|*
-\************************************************************************/
-/*
-SwPopupWindowTbxMgr::SwPopupWindowTbxMgr( USHORT nId, WindowAlign eAlign,
- ResId aRIdWin, ResId aRIdTbx,
- SfxBindings& rBindings ) :
- SvxPopupWindowTbxMgr( nId, eAlign, aRIdWin, aRIdTbx ),
- bWeb(FALSE),
- aRIdWinTemp(aRIdWin),
- aRIdTbxTemp(aRIdTbx),
- eAlignment( eAlign ),
- mrBindings( rBindings )
-{
- SfxObjectShell* pObjShell = SfxObjectShell::Current();
- if(PTR_CAST(SwWebDocShell, pObjShell))
- {
- bWeb = TRUE;
- ToolBox& rTbx = GetTbxMgr().GetToolBox();
- // jetzt muessen ein paar Items aus der Toolbox versteckt werden:
- switch(nId)
- {
- case FN_INSERT_CTRL:
- rTbx.ShowItem(FN_INSERT_FRAME_INTERACT_NOCOL);
- rTbx.HideItem(FN_INSERT_FRAME_INTERACT);
- rTbx.HideItem(FN_INSERT_FOOTNOTE);
- rTbx.HideItem(FN_INSERT_ENDNOTE);
- rTbx.HideItem(FN_PAGE_STYLE_SET_COLS);
- rTbx.HideItem(FN_INSERT_IDX_ENTRY_DLG);
-
- break;
- case FN_INSERT_FIELD_CTRL:
- rTbx.HideItem(FN_INSERT_FLD_PGNUMBER);
- rTbx.HideItem(FN_INSERT_FLD_PGCOUNT);
- rTbx.HideItem(FN_INSERT_FLD_TOPIC);
- rTbx.HideItem(FN_INSERT_FLD_TITLE);
- break;
- }
- }
- else if( FN_INSERT_CTRL == nId)
- {
- ToolBox& rTbx = GetTbxMgr().GetToolBox();
- rTbx.ShowItem(FN_INSERT_FRAME_INTERACT);
- rTbx.HideItem(FN_INSERT_FRAME_INTERACT_NOCOL);
- }
-
- Size aSize = GetTbxMgr().CalcWindowSizePixel();
- GetTbxMgr().SetPosSizePixel( Point(), aSize );
- SetOutputSizePixel( aSize );
-}
-*/
-/*************************************************************************
-|*
-|*
-|*
-\************************************************************************/
-/*
-void SwPopupWindowTbxMgr::StateChanged(USHORT nSID, SfxItemState eState,
- const SfxPoolItem* pState)
-{
- static USHORT __READONLY_DATA aInsertCtrl[] =
- {
- FN_INSERT_FRAME_INTERACT,
- FN_INSERT_FOOTNOTE,
- FN_INSERT_ENDNOTE,
- FN_PAGE_STYLE_SET_COLS,
- FN_INSERT_IDX_ENTRY_DLG,
- 0
- };
- static USHORT __READONLY_DATA aInsertFld[] =
- {
- FN_INSERT_FLD_PGNUMBER,
- FN_INSERT_FLD_PGCOUNT,
- FN_INSERT_FLD_TOPIC,
- FN_INSERT_FLD_TITLE,
- 0
- };
-
- SfxObjectShell* pObjShell = SfxObjectShell::Current();
- BOOL bNewWeb = 0 != PTR_CAST(SwWebDocShell, pObjShell);
-
- if(bWeb != bNewWeb)
- {
- bWeb = bNewWeb;
- ToolBox& rTbx = GetTbxMgr().GetToolBox();
- // jetzt muessen ein paar Items aus der Toolbox versteckt werden:
- const USHORT* pSid = 0;
-
- switch(nSID)
- {
- case FN_INSERT_CTRL:
- pSid = &aInsertCtrl[0];
- if(bWeb)
- rTbx.ShowItem(FN_INSERT_FRAME_INTERACT_NOCOL);
- else
- rTbx.HideItem(FN_INSERT_FRAME_INTERACT_NOCOL);
- break;
- case FN_INSERT_FIELD_CTRL:
- pSid = & aInsertFld[0];
- break;
- }
- if(pSid)
- {
- if(bWeb)
- while(*pSid)
- {
- rTbx.HideItem(*pSid);
- pSid++;
- }
- else
- while(*pSid)
- {
- rTbx.ShowItem(*pSid);
- pSid++;
- }
- Size aSize = GetTbxMgr().CalcWindowSizePixel();
- GetTbxMgr().SetPosSizePixel( Point(), aSize );
- SetOutputSizePixel( aSize );
- }
- }
-
- SfxPopupWindow::StateChanged(nSID, eState, pState);
-}
-*/
-/*
-SfxPopupWindow* SwPopupWindowTbxMgr::Clone() const
-{
- return new SwPopupWindowTbxMgr(
- GetId(),
- eAlignment,
-// ((SwPopupWindowTbxMgr*)this)->GetTbxMgr().GetToolBox().GetAlign(),
- aRIdWinTemp,
- aRIdTbxTemp,
- mrBindings
-// (SfxBindings&)GetBindings()
- );
-}
-*/
-
diff --git a/sw/source/ui/ribbar/workctrl.cxx b/sw/source/ui/ribbar/workctrl.cxx
index f802751a47ea..c75cb3f0dfc4 100644
--- a/sw/source/ui/ribbar/workctrl.cxx
+++ b/sw/source/ui/ribbar/workctrl.cxx
@@ -50,7 +50,6 @@
#include <gloshdl.hxx>
#include <glosdoc.hxx>
#include <gloslst.hxx>
-#include <tbxmgr.hxx>
#include <workctrl.hxx>
#ifndef _WORKCTRL_HRC
#include <workctrl.hrc>
diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx
index 886ff9c3b81c..52c4d10c3f02 100755
--- a/sw/source/ui/shells/annotsh.cxx
+++ b/sw/source/ui/shells/annotsh.cxx
@@ -96,8 +96,8 @@
#include <breakit.hxx>
#include "annotsh.hxx"
#include "view.hxx"
-#include "PostItMgr.hxx"
-#include "postit.hxx"
+#include <PostItMgr.hxx>
+#include <SidebarWin.hxx>
#include "swtypes.hxx"
@@ -160,22 +160,23 @@ SwAnnotationShell::~SwAnnotationShell()
SfxUndoManager* SwAnnotationShell::GetUndoManager()
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr ||
+ !pPostItMgr->HasActiveSidebarWin() )
{
DBG_ASSERT(pPostItMgr,"PostItMgr::Layout(): We are looping forever");
return 0;
}
- return &pPostItMgr->GetActivePostIt()->Engine()->GetUndoManager();
+ return &pPostItMgr->GetActiveSidebarWin()->GetOutlinerView()->GetOutliner()->GetUndoManager();
}
void SwAnnotationShell::Exec( SfxRequest &rReq )
{
//TODO: clean this up!!!!
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
SfxItemSet aEditAttr(pOLV->GetAttribs());
SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
@@ -269,7 +270,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
}
case FN_FORMAT_RESET:
{
- pPostItMgr->GetActivePostIt()->ResetAttributes();
+ pPostItMgr->GetActiveSidebarWin()->ResetAttributes();
rReq.Done();
break;
}
@@ -320,7 +321,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
aSel.nEndPos++;
pOLV->SetSelection(aSel);
}
- if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
pOLV->InsertField(SvxFieldItem(aFld, EE_FEATURE_FIELD));
}
break;
@@ -350,7 +351,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
}
case SID_CHARMAP:
{
- if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
InsertSymbol(rReq);
break;
}
@@ -359,7 +360,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
const SfxPoolItem* pItem = 0;
if(pNewAttrs)
pNewAttrs->GetItemState(nSlot, FALSE, &pItem );
- if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
pOLV->InsertText(((const SfxStringItem *)pItem)->GetValue());
break;
}
@@ -577,10 +578,10 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet)
//SID_ATTR_PARA_ADJUST_BLOCK
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
SfxItemSet aEditAttr(pOLV->GetAttribs());
SfxWhichIter aIter(rSet);
@@ -764,7 +765,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet)
if(nEEWhich)
rSet.Put(aEditAttr.Get(nEEWhich, sal_True), nWhich);
- if (pPostItMgr->GetActivePostIt()->GetStatus()==SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
rSet.DisableItem( nWhich );
nWhich = aIter.NextWhich();
@@ -784,19 +785,19 @@ void SwAnnotationShell::StateSearch(SfxItemSet &rSet)
void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
SfxItemSet aEditAttr(pOLV->GetAttribs());
SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
- long aOldHeight = pPostItMgr->GetActivePostIt()->GetPostItTextHeight();
+ long aOldHeight = pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight();
sal_uInt16 nSlot = rReq.GetSlot();
switch (nSlot)
{
case SID_CUT:
- if ( (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED) && pOLV->HasSelection() )
+ if ( (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) && pOLV->HasSelection() )
pOLV->Cut();
break;
case SID_COPY:
@@ -804,12 +805,12 @@ void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq)
pOLV->Copy();
break;
case SID_PASTE:
- if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
pOLV->Paste();
break;
case SID_PASTE_SPECIAL:
{
- if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( &rView.GetEditWin() );
@@ -852,19 +853,19 @@ void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq)
break;
}
}
- pPostItMgr->GetActivePostIt()->ResizeIfNeccessary(aOldHeight,pPostItMgr->GetActivePostIt()->GetPostItTextHeight());
+ pPostItMgr->GetActiveSidebarWin()->ResizeIfNeccessary(aOldHeight,pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight());
}
void SwAnnotationShell::StateClpbrd(SfxItemSet &rSet)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &rView.GetEditWin() ) );
bool bPastePossible = ( aDataHelper.HasFormat( SOT_FORMAT_STRING ) || aDataHelper.HasFormat( SOT_FORMAT_RTF ) );
- bPastePossible = bPastePossible && (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED);
+ bPastePossible = bPastePossible && (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED);
SfxWhichIter aIter(rSet);
sal_uInt16 nWhich = aIter.FirstWhich();
@@ -875,7 +876,7 @@ void SwAnnotationShell::StateClpbrd(SfxItemSet &rSet)
{
case SID_CUT:
{
- if ( (pPostItMgr->GetActivePostIt()->GetStatus()==SwPostItHelper::DELETED) || !pOLV->HasSelection() )
+ if ( (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED) || !pOLV->HasSelection() )
rSet.DisableItem( nWhich );
}
case SID_COPY:
@@ -939,10 +940,10 @@ void SwAnnotationShell::StateStatusLine(SfxItemSet &rSet)
void SwAnnotationShell::StateInsert(SfxItemSet &rSet)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
SfxWhichIter aIter(rSet);
sal_uInt16 nWhich = aIter.FirstWhich();
@@ -985,7 +986,7 @@ void SwAnnotationShell::StateInsert(SfxItemSet &rSet)
break;
}
- if (pPostItMgr->GetActivePostIt()->GetStatus()==SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
rSet.DisableItem( nWhich );
nWhich = aIter.NextWhich();
@@ -1006,8 +1007,8 @@ void SwAnnotationShell::NoteExec(SfxRequest &rReq)
case FN_POSTIT:
case FN_DELETE_COMMENT:
case FN_DELETE_NOTE:
- if ( pPostItMgr->GetActivePostIt() )
- pPostItMgr->GetActivePostIt()->ExecuteCommand(nSlot);
+ if ( pPostItMgr->HasActiveSidebarWin() )
+ pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot);
break;
case FN_DELETE_ALL_NOTES:
pPostItMgr->Delete();
@@ -1021,7 +1022,7 @@ void SwAnnotationShell::NoteExec(SfxRequest &rReq)
}
case FN_HIDE_NOTE:
/*
- if ( Mgr()->GetActivePostIt() == this )
+ if ( Mgr()->GetActiveSidebarWin() == this )
{
Mgr()->SetActivePostIt(0);
// put the cursor back into the document
@@ -1060,20 +1061,29 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet)
case FN_HIDE_NOTE_AUTHOR:
case FN_HIDE_ALL_NOTES:
{
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() || !pPostItMgr->GetActivePostIt()->ISA(SwPostIt))
+ if ( !pPostItMgr ||
+ !pPostItMgr->HasActiveAnnotationWin() )
+ {
rSet.DisableItem(nWhich);
+ }
break;
}
case FN_DELETE_COMMENT:
{
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() ) //|| !pPostItMgr->GetActivePostIt()->ISA(SwRedComment))
+ if ( !pPostItMgr ||
+ !pPostItMgr->HasActiveSidebarWin() /*HasActiveRedCommentWin()*/ )
+ {
rSet.DisableItem(nWhich);
+ }
break;
}
case FN_REPLY:
{
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() || !pPostItMgr->GetActivePostIt()->ISA(SwPostIt))
+ if ( !pPostItMgr ||
+ !pPostItMgr->HasActiveAnnotationWin() )
+ {
rSet.DisableItem(nWhich);
+ }
else
{
SvtUserOptions aUserOpt;
@@ -1081,7 +1091,7 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet)
if( !(sAuthor = aUserOpt.GetFullName()).Len())
if( !(sAuthor = aUserOpt.GetID()).Len() )
sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
- if (sAuthor == pPostItMgr->GetActivePostIt()->GetAuthor())
+ if (sAuthor == pPostItMgr->GetActiveSidebarWin()->GetAuthor())
rSet.DisableItem(nWhich);
}
break;
@@ -1091,9 +1101,9 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet)
break;
}
- if (pPostItMgr->GetActivePostIt())
+ if (pPostItMgr->HasActiveSidebarWin())
{
- if ( (pPostItMgr->GetActivePostIt()->IsProtected()) &&
+ if ( (pPostItMgr->GetActiveSidebarWin()->IsProtected()) &&
( (nSlotId==FN_DELETE_NOTE) || (nSlotId==FN_REPLY) ) )
rSet.DisableItem( nWhich );
}
@@ -1104,10 +1114,10 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet)
void SwAnnotationShell::ExecLingu(SfxRequest &rReq)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
SfxItemSet aEditAttr(pOLV->GetAttribs());
sal_uInt16 nSlot = rReq.GetSlot();
SwWrtShell &rSh = rView.GetWrtShell();
@@ -1219,10 +1229,10 @@ void SwAnnotationShell::ExecLingu(SfxRequest &rReq)
void SwAnnotationShell::GetLinguState(SfxItemSet &rSet)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
SfxItemSet aEditAttr(pOLV->GetAttribs());
SfxWhichIter aIter(rSet);
@@ -1264,7 +1274,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet)
break;
}
- if (pPostItMgr->GetActivePostIt()->GetStatus()==SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
rSet.DisableItem( nWhich );
nWhich = aIter.NextWhich();
@@ -1274,10 +1284,10 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet)
void SwAnnotationShell::ExecTransliteration(SfxRequest &rReq)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
using namespace ::com::sun::star::i18n;
{
@@ -1321,7 +1331,9 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq)
SfxUndoManager* pUndoManager = GetUndoManager();
SwWrtShell &rSh = rView.GetWrtShell();
- long aOldHeight = rView.GetPostItMgr()->GetActivePostIt() ? rView.GetPostItMgr()->GetActivePostIt()->GetPostItTextHeight() : 0;
+ long aOldHeight = rView.GetPostItMgr()->HasActiveSidebarWin()
+ ? rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight()
+ : 0;
USHORT nId = rReq.GetSlot();
sal_uInt16 nCnt = 1;
@@ -1381,14 +1393,14 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq)
rView.GetViewFrame()->GetBindings().InvalidateAll(sal_False);
- if (rView.GetPostItMgr()->GetActivePostIt())
- rView.GetPostItMgr()->GetActivePostIt()->ResizeIfNeccessary(aOldHeight,rView.GetPostItMgr()->GetActivePostIt()->GetPostItTextHeight());
+ if (rView.GetPostItMgr()->HasActiveSidebarWin())
+ rView.GetPostItMgr()->GetActiveSidebarWin()->ResizeIfNeccessary(aOldHeight,rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight());
}
void SwAnnotationShell::StateUndo(SfxItemSet &rSet)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
SfxWhichIter aIter(rSet);
@@ -1477,7 +1489,7 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet)
}
- if (pPostItMgr->GetActivePostIt()->GetStatus()==SwPostItHelper::DELETED)
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
rSet.DisableItem( nWhich );
nWhich = aIter.NextWhich();
@@ -1498,10 +1510,10 @@ void SwAnnotationShell::StateDisableItems( SfxItemSet &rSet )
void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
{
SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->GetActivePostIt() )
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
return;
- OutlinerView* pOLV = pPostItMgr->GetActivePostIt()->View();
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
const SfxItemSet *pArgs = rReq.GetArgs();
const SfxPoolItem* pItem = 0;
@@ -1554,7 +1566,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
// Wenn Zeichen selektiert ist kann es angezeigt werden
SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet,
- rView.GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP );
+ rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
USHORT nResult = pDlg->Execute();
if( nResult == RET_OK )
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index ab8d63ec7f12..0cee102729a7 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -186,7 +186,7 @@ void lcl_UpdateIMapDlg( SwWrtShell& rSh )
void* pEditObj = GRAPHIC_NONE != nGrfType && GRAPHIC_DEFAULT != nGrfType
? rSh.GetIMapInventor() : 0;
TargetList* pList = new TargetList;
- rSh.GetView().GetViewFrame()->GetTopFrame()->GetTargetList(*pList);
+ rSh.GetView().GetViewFrame()->GetTopFrame().GetTargetList(*pList);
SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
rSh.GetFlyFrmAttr( aSet );
@@ -2555,7 +2555,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq)
SvxBrushItem aBrush(RES_BACKGROUND);
rSh.GetBoxBackground( aBrush );
pDlg = pFact->CreateSfxDialog( pMDI, aSet,
- rView.GetViewFrame()->GetFrame()->GetFrameInterface(),
+ rView.GetViewFrame()->GetFrame().GetFrameInterface(),
RC_SWDLG_BACKGROUND );
DBG_ASSERT(pDlg, "Dialogdiet fail!");
aSet.Put( aBrush );
@@ -2574,7 +2574,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq)
rSh.GetFlyFrmAttr( aSet );
pDlg = pFact->CreateSfxDialog( pMDI, aSet,
- rView.GetViewFrame()->GetFrame()->GetFrameInterface(),
+ rView.GetViewFrame()->GetFrame().GetFrameInterface(),
RC_SWDLG_BACKGROUND );
DBG_ASSERT(pDlg, "Dialogdiet fail!");
if ( pDlg->Execute() == RET_OK )
@@ -2589,7 +2589,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq)
rSh.GetCurAttr( aSet );
pDlg = pFact->CreateSfxDialog( pMDI, aSet,
- rView.GetViewFrame()->GetFrame()->GetFrameInterface(),
+ rView.GetViewFrame()->GetFrame().GetFrameInterface(),
RC_SWDLG_BACKGROUND );
DBG_ASSERT(pDlg, "Dialogdiet fail!");
if ( pDlg->Execute() == RET_OK )
diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx
index ee3a581d420b..4b8e2c65c5fc 100644
--- a/sw/source/ui/shells/drwtxtsh.cxx
+++ b/sw/source/ui/shells/drwtxtsh.cxx
@@ -809,7 +809,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
// Wenn Zeichen selektiert ist kann es angezeigt werden
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet,
- rView.GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP );
+ rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
USHORT nResult = pDlg->Execute();
if( nResult == RET_OK )
{
diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx
index 4523ece1f8b4..5d972af52f72 100644
--- a/sw/source/ui/shells/frmsh.cxx
+++ b/sw/source/ui/shells/frmsh.cxx
@@ -450,7 +450,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
if(pArgs && pArgs->GetItemState(FN_FORMAT_FRAME_DLG, FALSE, &pItem) == SFX_ITEM_SET)
nDefPage = ((SfxUInt16Item *)pItem)->GetValue();
- aSet.Put(SfxFrameItem( SID_DOCFRAME, GetView().GetViewFrame()->GetTopFrame()));
+ aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame()));
FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric) ));
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
index 69e84ce48184..037758450081 100644
--- a/sw/source/ui/shells/grfsh.cxx
+++ b/sw/source/ui/shells/grfsh.cxx
@@ -225,7 +225,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
aSet.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, aUsrPref.IsKeepRatio()));
aSet.Put(SfxBoolItem( SID_ATTR_GRAF_KEEP_ZOOM, aUsrPref.IsGrfKeepZoom()));
- aSet.Put(SfxFrameItem( SID_DOCFRAME, GetView().GetViewFrame()->GetTopFrame()));
+ aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame()));
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
DBG_ASSERT(pFact, "Dialogdiet fail!");
diff --git a/sw/source/ui/shells/grfshex.cxx b/sw/source/ui/shells/grfshex.cxx
index 6bfc86cf59af..fe2e7502a3df 100644
--- a/sw/source/ui/shells/grfshex.cxx
+++ b/sw/source/ui/shells/grfshex.cxx
@@ -153,7 +153,7 @@ bool SwTextShell::InsertMediaDlg( SfxRequest& rReq )
pObj->setURL( aURL );
rSh.EnterStdMode();
- rSh.SwFEShell::Insert( *pObj, 0, 0, &aPos );
+ rSh.SwFEShell::InsertDrawObj( *pObj, aPos );
bRet = true;
if( pWindow )
diff --git a/sw/source/ui/shells/makefile.mk b/sw/source/ui/shells/makefile.mk
index 412304022516..e9a03a5a41cc 100644
--- a/sw/source/ui/shells/makefile.mk
+++ b/sw/source/ui/shells/makefile.mk
@@ -73,6 +73,7 @@ SLOFILES = \
$(SLO)$/txtnum.obj
EXCEPTIONSFILES = \
+ $(SLO)$/basesh.obj \
$(SLO)$/annotsh.obj \
$(SLO)$/drwtxtsh.obj \
$(SLO)$/textsh.obj \
diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx
index 7ff660a6c0bb..5f3389791122 100644
--- a/sw/source/ui/shells/tabsh.cxx
+++ b/sw/source/ui/shells/tabsh.cxx
@@ -729,7 +729,7 @@ void SwTableShell::Execute(SfxRequest &rReq)
DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(),aCoreSet,
- pView->GetViewFrame()->GetFrame()->GetFrameInterface(),
+ pView->GetViewFrame()->GetFrame().GetFrameInterface(),
RC_DLG_SWNUMFMTDLG );
DBG_ASSERT(pDlg, "Dialogdiet fail!");
diff --git a/sw/source/ui/shells/textdrw.cxx b/sw/source/ui/shells/textdrw.cxx
index 5c6d043e0e01..e4d1bc817940 100644
--- a/sw/source/ui/shells/textdrw.cxx
+++ b/sw/source/ui/shells/textdrw.cxx
@@ -133,7 +133,6 @@ void SwBaseShell::InsertURLButton(const String& rURL, const String& rTarget, con
if (rSh.IsObjSelected())
{
-// rSh.ChgAnchor(FLY_AT_CNTNT);
rSh.UnSelectFrm();
}
}
diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx
index a5093e8efcdd..3f26e47c8823 100644
--- a/sw/source/ui/shells/textfld.cxx
+++ b/sw/source/ui/shells/textfld.cxx
@@ -80,8 +80,7 @@
#include <app.hrc>
-#include "PostItMgr.hxx"
-#include "postit.hxx"
+#include <PostItMgr.hxx>
using namespace nsSwDocInfoSubType;
@@ -315,8 +314,11 @@ void SwTextShell::ExecField(SfxRequest &rReq)
}
break;
case FN_DELETE_NOTE:
- if ( GetView().GetPostItMgr() && GetView().GetPostItMgr()->GetActivePostIt() )
- GetView().GetPostItMgr()->GetActivePostIt()->Delete();
+ if ( GetView().GetPostItMgr() &&
+ GetView().GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ GetView().GetPostItMgr()->DeleteActiveSidebarWin();
+ }
break;
case FN_DELETE_ALL_NOTES:
if ( GetView().GetPostItMgr() )
@@ -330,8 +332,11 @@ void SwTextShell::ExecField(SfxRequest &rReq)
}
break;
case FN_HIDE_NOTE:
- if ( GetView().GetPostItMgr() && GetView().GetPostItMgr()->GetActivePostIt() )
- GetView().GetPostItMgr()->GetActivePostIt()->Hide();
+ if ( GetView().GetPostItMgr() &&
+ GetView().GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ GetView().GetPostItMgr()->HideActiveSidebarWin();
+ }
break;
case FN_HIDE_ALL_NOTES:
if ( GetView().GetPostItMgr() )
@@ -627,7 +632,7 @@ void SwTextShell::StateField( SfxItemSet &rSet )
SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
if ( !pPostItMgr )
rSet.InvalidateItem( nWhich );
- else if ( !pPostItMgr->GetActivePostIt() )
+ else if ( !pPostItMgr->HasActiveSidebarWin() )
{
rSet.InvalidateItem( FN_DELETE_NOTE );
rSet.InvalidateItem( FN_HIDE_NOTE );
diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx
index 7cbf1767c014..c2308b9def0a 100644
--- a/sw/source/ui/shells/textsh.cxx
+++ b/sw/source/ui/shells/textsh.cxx
@@ -1140,7 +1140,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aAllSet,
- GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP );
+ GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
if( RET_OK == pDlg->Execute() )
{
SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, FALSE );
diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx
index 50ae047a8b93..9e89620bed28 100644
--- a/sw/source/ui/shells/txtattr.cxx
+++ b/sw/source/ui/shells/txtattr.cxx
@@ -561,7 +561,7 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq)
DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aSet,
- rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), DLG_SWDROPCAPS );
+ rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), DLG_SWDROPCAPS );
DBG_ASSERT(pDlg, "Dialogdiet fail!");
if (pDlg->Execute() == RET_OK)
{
diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx
index aeebee5eecfe..d499add5ad53 100644
--- a/sw/source/ui/uiview/pview.cxx
+++ b/sw/source/ui/uiview/pview.cxx
@@ -44,7 +44,6 @@
#include <sfx2/printer.hxx>
#include <sfx2/progress.hxx>
#include <sfx2/app.hxx>
-#include <sfx2/topfrm.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/request.hxx>
#include <sfx2/dispatch.hxx>
@@ -128,8 +127,7 @@ SFX_IMPL_INTERFACE(SwPagePreView, SfxViewShell, SW_RES(RID_PVIEW_TOOLBOX))
TYPEINIT1(SwPagePreView,SfxViewShell)
-#define SWVIEWFLAGS ( SFX_VIEW_MAXIMIZE_FIRST|SFX_VIEW_OPTIMIZE_EACH| \
- SFX_VIEW_CAN_PRINT|SFX_VIEW_HAS_PRINTOPTIONS )
+#define SWVIEWFLAGS ( SFX_VIEW_CAN_PRINT|SFX_VIEW_HAS_PRINTOPTIONS )
#define MIN_PREVIEW_ZOOM 25
#define MAX_PREVIEW_ZOOM 600
@@ -1057,7 +1055,7 @@ void SwPagePreViewWin::Command( const CommandEvent& rCEvt )
if( pData )
{
const CommandWheelData aDataNew(pData->GetDelta(),pData->GetNotchDelta(),COMMAND_WHEEL_PAGESCROLL,
- pData->GetMode(),pData->GetModifier(),pData->IsHorz());
+ pData->GetMode(),pData->GetModifier(),pData->IsHorz(), pData->IsDeltaPixel());
const CommandEvent aEvent( rCEvt.GetMousePosPixel(),rCEvt.GetCommand(),rCEvt.IsMouseEvent(),&aDataNew);
bCallBase = !mrView.HandleWheelCommands( aEvent );
}
@@ -1566,7 +1564,8 @@ void SwPagePreView::GetState( SfxItemSet& rSet )
ASSERT(nWhich, leeres Set);
SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout();
//#106746# zoom has to be disabled if Accessibility support is switched on
- BOOL bZoomEnabled = !Application::GetSettings().GetMiscSettings().GetEnableATToolSupport();
+ // MT 2010/01, see #110498#
+ BOOL bZoomEnabled = TRUE; // !Application::GetSettings().GetMiscSettings().GetEnableATToolSupport();
while(nWhich)
{
@@ -1816,7 +1815,7 @@ SwPagePreView::SwPagePreView(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
pPageUpBtn(0),
pPageDownBtn(0),
pScrollFill(new ScrollBarBox( &pViewFrame->GetWindow(),
- pViewFrame->GetFrame()->GetParentFrame() ? 0 : WB_SIZEABLE )),
+ pViewFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )),
mnPageCount( 0 ),
// OD 09.01.2003 #106334#
mbResetFormDesignMode( false ),
@@ -1901,15 +1900,13 @@ SwPagePreView::SwPagePreView(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
delete pPageDownBtn;
/* SfxObjectShell* pDocSh = GetDocShell();
- TypeId aType = TYPE( SfxTopViewFrame );
-
- for( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocSh, aType );
- pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pDocSh, aType ) )
+ for( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocSh );
+ pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pDocSh ) )
if( pFrame != GetViewFrame() )
{
// es gibt noch eine weitere Sicht auf unser Dokument, also
// aktiviere dieses
- pFrame->GetFrame()->Appear();
+ pFrame->GetFrame().Appear();
break;
}
*/}
@@ -2086,8 +2083,11 @@ void SwPagePreView::OuterResizePixel( const Point &rOfst, const Size &rSize )
//Aufruf der DocSzChgd-Methode der Scrollbars ist noetig, da vom maximalen
//Scrollrange immer die halbe Hoehe der VisArea abgezogen wird.
- if ( pVScrollbar )
- ScrollDocSzChg();
+ if ( pVScrollbar &&
+ aTmpSize.Width() > 0 && aTmpSize.Height() > 0 )
+ {
+ ScrollDocSzChg();
+ }
}
/*--------------------------------------------------------------------
diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx
index 58ce311d800d..c7c52e3f53ff 100644
--- a/sw/source/ui/uiview/srcview.cxx
+++ b/sw/source/ui/uiview/srcview.cxx
@@ -111,9 +111,7 @@ using ::rtl::OUString;
using ::com::sun::star::util::SearchOptions;
-#define SWSRCVIEWFLAGS ( SFX_VIEW_MAXIMIZE_FIRST| \
- SFX_VIEW_OBJECTSIZE_EMBEDDED| \
- SFX_VIEW_CAN_PRINT|\
+#define SWSRCVIEWFLAGS ( SFX_VIEW_CAN_PRINT|\
SFX_VIEW_NO_NEWWINDOW )
#define SRC_SEARCHOPTIONS (0xFFFF & ~(SEARCH_OPTIONS_FORMAT|SEARCH_OPTIONS_FAMILIES|SEARCH_OPTIONS_SEARCH_ALL))
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index 677015b25d96..4396ff03807c 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -127,14 +127,9 @@ using ::rtl::OUStringBuffer;
extern sal_Bool bNoInterrupt; // in mainwn.cxx
-#define SWVIEWFLAGS ( SFX_VIEW_MAXIMIZE_FIRST| \
- SFX_VIEW_OBJECTSIZE_EMBEDDED| \
- SFX_VIEW_CAN_PRINT| \
+#define SWVIEWFLAGS ( SFX_VIEW_CAN_PRINT| \
SFX_VIEW_HAS_PRINTOPTIONS)
-//MA 06. Nov. 95: Each raus in Absprache mit MI wg. Bug 21523
-// SFX_VIEW_OPTIMIZE_EACH|
-
/*--------------------------------------------------------------------
Beschreibung: Statics
--------------------------------------------------------------------*/
@@ -174,7 +169,7 @@ inline SfxDispatcher &SwView::GetDispatcher()
void SwView::ImpSetVerb( int nSelType )
{
sal_Bool bResetVerbs = bVerbsActive;
- if ( !GetViewFrame()->GetFrame()->IsInPlace() &&
+ if ( !GetViewFrame()->GetFrame().IsInPlace() &&
(nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF) & nSelType )
{
if ( !pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT) )
@@ -217,7 +212,7 @@ void SwView::GotFocus() const
SwAnnotationShell* pAsAnnotationShell = PTR_CAST( SwAnnotationShell, pTopShell );
if ( pAsAnnotationShell )
{
- mpPostItMgr->SetActivePostIt(0);
+ mpPostItMgr->SetActiveSidebarWin(0);
const_cast< SwView* >( this )->AttrChangedNotify( pWrtShell );
}
}
@@ -756,7 +751,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
pFormShell(0),
pHScrollbar(0),
pVScrollbar(0),
- pScrollFill(new ScrollBarBox( &_pFrame->GetWindow(), _pFrame->GetFrame()->GetParentFrame() ? 0 : WB_SIZEABLE )),
+ pScrollFill(new ScrollBarBox( &_pFrame->GetWindow(), _pFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )),
pHRuler( new SvxRuler(&GetViewFrame()->GetWindow(), pEditWin,
SVXRULER_SUPPORT_TABS |
SVXRULER_SUPPORT_PARAGRAPH_MARGINS |
@@ -928,10 +923,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
if( SFX_CREATE_MODE_EMBEDDED != pDocSh->GetCreateMode() )
aBrwsBorder = GetMargin();
- if( _pFrame->GetFrameType() & SFXFRAME_INTERNAL )
- pWrtShell->SetFrameView( aBrwsBorder );
- else
- pWrtShell->SetBrowseBorder( aBrwsBorder );
+ pWrtShell->SetBrowseBorder( aBrwsBorder );
// Im CTOR duerfen keine Shell wechsel erfolgen, die muessen ueber
// den Timer "zwischen gespeichert" werden. Sonst raeumt der SFX
@@ -943,7 +935,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
pVRuler->SetActive( sal_True );
SfxViewFrame* pViewFrame = GetViewFrame();
- if( pViewFrame->GetFrame()->GetParentFrame())
+ if( pViewFrame->GetFrame().GetParentFrame())
{
aUsrPref.SetViewHRuler(sal_False);
aUsrPref.SetViewVRuler(sal_False);
@@ -1002,13 +994,6 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
pWrtShell->SetReadOnlyAvailable( aUsrPref.IsCursorInProtectedArea() );
pWrtShell->ApplyAccessiblityOptions(SW_MOD()->GetAccessibilityOptions());
- if( UseObjectSize() )
- {
- //Damit der Sfx _rechtzeitig weiss_, wie gross die sheet::Border sind.
- SvBorder aTmp;
- CalcAndSetBorderPixel( aTmp, sal_True );
- }
-
if( pWrtShell->GetDoc()->IsUpdateExpFld() )
{
SET_CURR_SHELL( pWrtShell );
@@ -1057,10 +1042,10 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
/*uno::Reference< awt::XWindow > aTmpRef;
- _pFrame->GetFrame()->GetFrameInterface()->setComponent( aTmpRef,
+ _pFrame->GetFrame().GetFrameInterface()->setComponent( aTmpRef,
pViewImpl->GetUNOObject_Impl());*/
- uno::Reference< frame::XFrame > xFrame = pVFrame->GetFrame()->GetFrameInterface();
+ uno::Reference< frame::XFrame > xFrame = pVFrame->GetFrame().GetFrameInterface();
uno::Reference< frame::XFrame > xBeamerFrame = xFrame->findFrame(
OUString::createFromAscii("_beamer"), frame::FrameSearchFlag::CHILDREN);
@@ -1414,11 +1399,6 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >
pValue->Value >>= bSelectedFrame;
bGotIsSelectedFrame = sal_True;
}
- else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsSelectedFrame" ) ) )
- {
- pValue->Value >>= bSelectedFrame;
- bGotIsSelectedFrame = sal_True;
- }
pValue++;
}
if (bGotVisibleBottom)
@@ -1622,7 +1602,7 @@ void SwView::ShowCursor( FASTBOOL bOn )
ErrCode SwView::DoVerb( long nVerb )
{
- if ( !GetViewFrame()->GetFrame()->IsInPlace() )
+ if ( !GetViewFrame()->GetFrame().IsInPlace() )
{
SwWrtShell &rSh = GetWrtShell();
const int nSel = rSh.GetSelectionType();
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index 14c416f5e398..e19e06916145 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -72,7 +72,6 @@
#include <sfx2/fcontnr.hxx>
#include <editeng/sizeitem.hxx>
#include <sfx2/dispatch.hxx>
-#include <sfx2/topfrm.hxx>
#include <svl/whiter.hxx>
#include <svl/ptitem.hxx>
#include <sfx2/linkmgr.hxx>
@@ -126,7 +125,6 @@
#include <dbmgr.hxx>
#include <PostItMgr.hxx>
-#include <postit.hxx>
#include <ndtxt.hxx> //#outline level,added by zhaojianwei
@@ -1028,7 +1026,7 @@ void __EXPORT SwView::Execute(SfxRequest &rReq)
if(bQuery)
{
SfxViewFrame* pTmpFrame = GetViewFrame();
- SfxHelp::OpenHelpAgent( pTmpFrame->GetFrame(), HID_MAIL_MERGE_SELECT );
+ SfxHelp::OpenHelpAgent( &pTmpFrame->GetFrame(), HID_MAIL_MERGE_SELECT );
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
DBG_ASSERT(pFact, "Dialogdiet fail!");
AbstractMailMergeCreateFromDlg* pDlg = pFact->CreateMailMergeCreateFromDlg( DLG_MERGE_CREATE,
@@ -1370,12 +1368,12 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
{
ASSERT( !this,
"was ist das fuer ein Verzeichnis?" );
- sStr = pCurrSect->GetName();
+ sStr = pCurrSect->GetSectionName();
}
}
break;
default:
- sStr = pCurrSect->GetName();
+ sStr = pCurrSect->GetSectionName();
break;
}
}
@@ -1761,8 +1759,10 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq)
break;
case SID_ATTR_INSERT:
SwPostItMgr* pMgr = GetPostItMgr();
- if (pMgr && pMgr->GetActivePostIt())
- pMgr->GetActivePostIt()->ToggleInsMode();
+ if ( pMgr && pMgr->HasActiveSidebarWin() )
+ {
+ pMgr->ToggleInsModeOnActiveSidebarWin();
+ }
else
rSh.ToggleInsMode();
bUp = TRUE;
@@ -1777,9 +1777,6 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq)
}
}
-
-
-
void SwView::InsFrmMode(USHORT nCols)
{
if ( pWrtShell->HasWholeTabSelection() )
diff --git a/sw/source/ui/uiview/viewdraw.cxx b/sw/source/ui/uiview/viewdraw.cxx
index fe38c56f29e5..7e35ca0049df 100644
--- a/sw/source/ui/uiview/viewdraw.cxx
+++ b/sw/source/ui/uiview/viewdraw.cxx
@@ -171,7 +171,7 @@ void SwView::ExecDraw(SfxRequest& rReq)
// TODO: unmark all other
pWrtShell->EnterStdMode();
- pWrtShell->SwFEShell::Insert( *pObj, 0, 0, &aStartPos );
+ pWrtShell->SwFEShell::InsertDrawObj( *pObj, aStartPos );
}
}
}
@@ -218,7 +218,7 @@ void SwView::ExecDraw(SfxRequest& rReq)
aSize = Size( 2835, 2835 );
pWrtShell->EnterStdMode();
- pWrtShell->SwFEShell::Insert( *pObj, 0, 0, &aPos );
+ pWrtShell->SwFEShell::InsertDrawObj( *pObj, aPos );
rReq.Ignore ();
}
}
diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx
index 05191276e0d0..04414b5d83db 100644
--- a/sw/source/ui/uiview/viewling.cxx
+++ b/sw/source/ui/uiview/viewling.cxx
@@ -830,10 +830,9 @@ sal_Bool SwView::ExecSpellPopup(const Point& rPt)
else
{
SfxViewFrame *pSfxViewFrame = GetViewFrame();
- SfxFrame *pSfxFrame = pSfxViewFrame? pSfxViewFrame->GetFrame() : 0;
uno::Reference< frame::XFrame > xFrame;
- if (pSfxFrame)
- xFrame = pSfxFrame->GetFrameInterface();
+ if ( pSfxViewFrame )
+ xFrame = pSfxViewFrame->GetFrame().GetFrameInterface();
com::sun::star::util::URL aURL;
uno::Reference< frame::XDispatchProvider > xDispatchProvider( xFrame, UNO_QUERY );
uno::Reference< lang::XMultiServiceFactory > xMgr( utl::getProcessServiceFactory(), uno::UNO_QUERY );
diff --git a/sw/source/ui/uiview/viewmdi.cxx b/sw/source/ui/uiview/viewmdi.cxx
index 8df3116fa189..9dfa8e79ecfa 100644
--- a/sw/source/ui/uiview/viewmdi.cxx
+++ b/sw/source/ui/uiview/viewmdi.cxx
@@ -82,7 +82,6 @@
#include <IDocumentSettingAccess.hxx>
#include <PostItMgr.hxx>
-#include <postit.hxx>
USHORT SwView::nMoveType = NID_PGE;
sal_Int32 SwView::nActMark = 0;
@@ -178,7 +177,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
nFac = Max( long( MINZOOM ), nFac );
SwViewOption aOpt( *pOpt );
- if ( !GetViewFrame()->GetFrame()->IsInPlace() )
+ if ( !GetViewFrame()->GetFrame().IsInPlace() )
{
//MasterUsrPrefs updaten UND DANACH die ViewOptions der aktuellen
//View updaten.
@@ -241,12 +240,12 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
if( bUnLockView )
pWrtShell->LockView( FALSE );
- if ( mpPostItMgr )
- {
- mpPostItMgr->Rescale();
- mpPostItMgr->CalcRects();
- mpPostItMgr->LayoutPostIts();
- }
+// if ( mpPostItMgr )
+// {
+// mpPostItMgr->Rescale();
+// mpPostItMgr->CalcRects();
+// mpPostItMgr->LayoutPostIts();
+// }
// eZoom = eZoomType;
}
@@ -261,7 +260,7 @@ void SwView::SetViewLayout( USHORT nColumns, bool bBookMode, BOOL bViewOnly )
ACT_KONTEXT(pWrtShell);
- if ( !GetViewFrame()->GetFrame()->IsInPlace() && !bViewOnly )
+ if ( !GetViewFrame()->GetFrame().IsInPlace() && !bViewOnly )
{
const BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
SwMasterUsrPref *pUsrPref = (SwMasterUsrPref*)SW_MOD()->GetUsrPref(bWeb);
@@ -347,7 +346,7 @@ void SwView::CreatePageButtons(BOOL bShow)
pPageUpBtn->SetHelpId(HID_SCRL_PAGEUP);
pPageDownBtn = new SwHlpImageButton(pMDI, SW_RES( BTN_PAGEDOWN ), FALSE );
pPageDownBtn->SetHelpId(HID_SCRL_PAGEDOWN);
- Reference< XFrame > xFrame = GetViewFrame()->GetFrame()->GetFrameInterface();
+ Reference< XFrame > xFrame = GetViewFrame()->GetFrame().GetFrameInterface();
pNaviBtn = new SwNaviImageButton(pMDI, xFrame );
pNaviBtn->SetHelpId(HID_SCRL_NAVI);
Link aLk( LINK( this, SwView, BtnPage ) );
@@ -489,15 +488,15 @@ IMPL_STATIC_LINK( SwView, MoveNavigationHdl, bool *, pbNext )
break;
case NID_POSTIT:
{
- SwMarginWin* pPostIt = pThis->GetPostItMgr()->GetActivePostIt();
+ sw::sidebarwindows::SwSidebarWin* pPostIt = pThis->GetPostItMgr()->GetActiveSidebarWin();
if (pPostIt)
- pThis->GetPostItMgr()->SetActivePostIt(0);
+ pThis->GetPostItMgr()->SetActiveSidebarWin(0);
SwFieldType* pFldType = rSh.GetFldType(0, RES_POSTITFLD);
if (rSh.MoveFldType(pFldType, bNext))
pThis->GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
else
//first/last item
- pThis->GetPostItMgr()->SetActivePostIt(pPostIt);
+ pThis->GetPostItMgr()->SetActiveSidebarWin(pPostIt);
}
break;
case NID_SRCH_REP:
diff --git a/sw/source/ui/uiview/viewport.cxx b/sw/source/ui/uiview/viewport.cxx
index 3d8c3f05e1f7..b343619f2ea8 100644
--- a/sw/source/ui/uiview/viewport.cxx
+++ b/sw/source/ui/uiview/viewport.cxx
@@ -221,7 +221,7 @@ aDocSz = rSz;
SetVisArea( aNewVisArea, FALSE );
if ( UpdateScrollbars() && !bInOuterResizePixel && !bInInnerResizePixel &&
- !GetViewFrame()->GetFrame()->IsInPlace())
+ !GetViewFrame()->GetFrame().IsInPlace())
OuterResizePixel( Point(),
GetViewFrame()->GetWindow().GetOutputSizePixel() );
}
@@ -355,7 +355,7 @@ void SwView::SetVisArea( const Point &rPt, BOOL bUpdateScrollbar )
void SwView::CheckVisArea()
{
pHScrollbar->SetAuto( pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) &&
- !GetViewFrame()->GetFrame()->IsInPlace() );
+ !GetViewFrame()->GetFrame().IsInPlace() );
if ( IsDocumentBorder() )
{
if ( aVisArea.Left() != DOCUMENTBORDER ||
@@ -732,7 +732,7 @@ IMPL_LINK( SwView, ScrollHdl, SwScrollbar *, pScrollbar )
{
// JP 21.07.00: the end scrollhandler invalidate the FN_STAT_PAGE,
// so we dont must do it agin.
-// if(!GetViewFrame()->GetFrame()->IsInPlace())
+// if(!GetViewFrame()->GetFrame().IsInPlace())
// S F X_BINDINGS().Update(FN_STAT_PAGE);
//QuickHelp:
@@ -1053,7 +1053,7 @@ void SwView::InnerResizePixel( const Point &rOfst, const Size &rSize )
Size aSz( rSize );
SvBorder aBorder;
CalcAndSetBorderPixel( aBorder, TRUE );
- if ( GetViewFrame()->GetFrame()->IsInPlace() )
+ if ( GetViewFrame()->GetFrame().IsInPlace() )
{
Size aViewSize( aSz );
Point aViewPos( rOfst );
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
index b12fc6280cc9..57c7bd20623c 100644
--- a/sw/source/ui/uiview/viewsrch.cxx
+++ b/sw/source/ui/uiview/viewsrch.cxx
@@ -602,7 +602,7 @@ void SwView::Replace()
}
else
{
- if (GetPostItMgr()->GetActivePostIt())
+ if (GetPostItMgr()->HasActiveSidebarWin())
GetPostItMgr()->Replace(pSrchItem);
sal_Bool bReplaced = pWrtShell->SwEditShell::Replace( pSrchItem->GetReplaceString(),
pSrchItem->GetRegExp());
diff --git a/sw/source/ui/uiview/viewtab.cxx b/sw/source/ui/uiview/viewtab.cxx
index 7088347480a8..44e314a7475b 100644
--- a/sw/source/ui/uiview/viewtab.cxx
+++ b/sw/source/ui/uiview/viewtab.cxx
@@ -422,7 +422,8 @@ void SwView::ExecTabWin( SfxRequest& rReq )
::ResizeFrameCols(aCols, aSectRect.Width(), aSectRect.Width() - nDiffWidth, nLeftDiff );
aSet.Put( aCols );
}
- rSh.ChgSection( rSh.GetSectionFmtPos(*pSectFmt), *pCurrSect, &aSet );
+ SwSectionData aData(*pCurrSect);
+ rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet);
}
else
{ // Seitenraender einstellen
@@ -511,8 +512,8 @@ void SwView::ExecTabWin( SfxRequest& rReq )
::ResizeFrameCols(aCols, aSectRect.Height(), aSectRect.Height() - nDiffWidth, nLeftDiff );
aSet.Put( aCols );
}
- rSh.ChgSection( rSh.GetSectionFmtPos(*pSectFmt), *pCurrSect, &aSet );
-
+ SwSectionData aData(*pCurrSect);
+ rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet);
}
else
{ SwPageDesc aDesc( rDesc );
diff --git a/sw/source/ui/uno/unodispatch.cxx b/sw/source/ui/uno/unodispatch.cxx
index 4cfbdf7c40ab..7f0347ac8bf7 100644
--- a/sw/source/ui/uno/unodispatch.cxx
+++ b/sw/source/ui/uno/unodispatch.cxx
@@ -57,8 +57,7 @@ const sal_Char* cInternalDBChangeNotification = ".uno::Writer/DataSourceChanged"
SwXDispatchProviderInterceptor::SwXDispatchProviderInterceptor(SwView& rVw) :
m_pView(&rVw)
{
- SfxFrame* pFrame = m_pView->GetViewFrame()->GetFrame();
- uno::Reference< frame::XFrame> xUnoFrame = pFrame->GetFrameInterface();
+ uno::Reference< frame::XFrame> xUnoFrame = m_pView->GetViewFrame()->GetFrame().GetFrameInterface();
m_xIntercepted = uno::Reference< frame::XDispatchProviderInterception>(xUnoFrame, uno::UNO_QUERY);
if(m_xIntercepted.is())
{
diff --git a/sw/source/ui/uno/unodoc.cxx b/sw/source/ui/uno/unodoc.cxx
index 49e8f37f2b06..3558b5391a06 100644
--- a/sw/source/ui/uno/unodoc.cxx
+++ b/sw/source/ui/uno/unodoc.cxx
@@ -66,9 +66,7 @@ uno::Reference< uno::XInterface > SAL_CALL SwTextDocument_createInstance(
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
SwDLL::Init();
- const SfxObjectCreateMode eCreateMode = ( _nCreationFlags & SFXMODEL_EMBEDDED_OBJECT ) ? SFX_CREATE_MODE_EMBEDDED : SFX_CREATE_MODE_STANDARD;
- const bool bScriptSupport = ( _nCreationFlags & SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) == 0;
- SfxObjectShell* pShell = new SwDocShell( eCreateMode, bScriptSupport );
+ SfxObjectShell* pShell = new SwDocShell( _nCreationFlags );
return uno::Reference< uno::XInterface >( pShell->GetModel() );
}
diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx
index c0645c0d0648..06b9e62b4a94 100644
--- a/sw/source/ui/uno/unomailmerge.cxx
+++ b/sw/source/ui/uno/unomailmerge.cxx
@@ -426,7 +426,7 @@ SwXMailMerge::SwXMailMerge() :
SwDocShell *pDocShell = new SwDocShell( SFX_CREATE_MODE_STANDARD );
xDocSh = pDocShell;
xDocSh->DoInitNew( 0 );
- SfxViewFrame *pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE );
+ SfxViewFrame *pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
SwView *pView = (SwView*) pFrame->GetViewShell();
pView->AttrChangedNotify( &pView->GetWrtShell() );//Damit SelectShell gerufen wird.
@@ -624,7 +624,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
aCurSelection = aTranslated;
}
- SfxViewFrame* pFrame = SfxViewFrame::GetFirst( xCurDocSh, 0, FALSE);
+ SfxViewFrame* pFrame = SfxViewFrame::GetFirst( xCurDocSh, FALSE);
SwView *pView = PTR_CAST( SwView, pFrame->GetViewShell() );
if (!pView)
throw RuntimeException();
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index e60241b19814..a4167da88748 100644..100755
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -35,6 +35,7 @@
#include <vcl/print.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/sfxbasecontroller.hxx>
+#include <sfx2/docfile.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <toolkit/awt/vclxdevice.hxx>
#include <cmdid.h>
@@ -220,7 +221,6 @@ void lcl_DisposeView( SfxViewFrame* pToClose, SwDocShell* pDocShell )
{
// check if the view frame still exists
SfxViewFrame* pFound = SfxViewFrame::GetFirst( pDocShell,
- 0,
FALSE );
while(pFound)
{
@@ -231,7 +231,6 @@ void lcl_DisposeView( SfxViewFrame* pToClose, SwDocShell* pDocShell )
}
pFound = SfxViewFrame::GetNext( *pFound,
pDocShell,
- 0,
FALSE );
}
}
@@ -1223,7 +1222,7 @@ void SwXTextDocument::printPages(const Sequence< beans::PropertyValue >& xOption
::vos::OGuard aGuard(Application::GetSolarMutex());
if(IsValid())
{
- SfxViewFrame* pFrame = SfxViewFrame::CreateViewFrame( *pDocShell, 7, sal_True );
+ SfxViewFrame* pFrame = SfxViewFrame::LoadHiddenDocument( *pDocShell, 7 );
SfxRequest aReq(FN_PRINT_PAGEPREVIEW, SFX_CALLMODE_SYNCHRON,
pDocShell->GetDoc()->GetAttrPool());
aReq.AppendItem(SfxBoolItem(FN_PRINT_PAGEPREVIEW, sal_True));
@@ -2698,7 +2697,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
if (!pWrtShell)
{
//create a hidden view to be able to export as PDF also in print preview
- m_pHiddenViewFrame = SfxViewFrame::CreateViewFrame( *pRenderDocShell, 2, TRUE );
+ m_pHiddenViewFrame = SfxViewFrame::LoadHiddenDocument( *pRenderDocShell, 2 );
SwView* pSwView = (SwView*) m_pHiddenViewFrame->GetViewShell();
pWrtShell = pSwView->GetWrtShellPtr();
}
@@ -2711,6 +2710,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
const TypeId aSwViewTypeId = TYPE(SwView);
if (pView->IsA(aSwViewTypeId))
{
+ if (m_pRenderData && m_pRenderData->NeedNewViewOptionAdjust( *pWrtShell ) )
+ m_pRenderData->ViewOptionAdjustStop();
if (m_pRenderData && !m_pRenderData->IsViewOptionAdjust())
m_pRenderData->ViewOptionAdjustStart( *pWrtShell, *pWrtShell->GetViewOptions() );
}
@@ -2813,6 +2814,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
m_pPrintUIOptions->processProperties( rxOptions );
const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false );
const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport );
+ const bool bPrintPaperFromSetup = m_pPrintUIOptions->getBoolValue( "PrintPaperFromSetup", false );
SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport );
DBG_ASSERT( pDoc && pView, "doc or view shell missing!" );
@@ -2840,7 +2842,21 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
uno::Sequence< beans::PropertyValue > aRenderer;
if (m_pRenderData)
{
+ const USHORT nPage = nRenderer + 1;
+
+ // get paper tray to use ...
+ sal_Int32 nPrinterPaperTray = -1;
+ if (! bPrintPaperFromSetup)
+ {
+ // ... from individual page style (see the page tab in Format/Page dialog)
+ const std::map< sal_Int32, sal_Int32 > &rPaperTrays = m_pRenderData->GetPrinterPaperTrays();
+ std::map< sal_Int32, sal_Int32 >::const_iterator aIt( rPaperTrays.find( nPage ) );
+ if (aIt != rPaperTrays.end())
+ nPrinterPaperTray = aIt->second;
+ }
+
awt::Size aPageSize;
+ awt::Size aPreferredPageSize;
Size aTmpSize;
if (bIsSwSrcView || bPrintProspect)
{
@@ -2858,36 +2874,49 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
Printer *pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions ));
if (pPrinter)
{
+ // HTML source view and prospect adapt to the printer's paper size
+ aTmpSize = pPrinter->GetPaperSize();
+ aTmpSize = pPrinter->LogicToLogic( aTmpSize,
+ pPrinter->GetMapMode(), MapMode( MAP_100TH_MM ));
+ aPageSize = awt::Size( aTmpSize.Width(), aTmpSize.Height() );
if (bPrintProspect)
{
- aTmpSize = pDoc->GetPageSize( USHORT(nRenderer + 1), bIsSkipEmptyPages );
// we just state what output size we would need
- // the rest is nowadays up to vcl
- aPageSize = awt::Size ( TWIP_TO_MM100( 2 * aTmpSize.Width() ),
- TWIP_TO_MM100( aTmpSize.Height() ));
- }
- else
- {
- // printing HTML source view
- aTmpSize = pPrinter->GetPaperSize();
- aTmpSize = pPrinter->LogicToLogic( aTmpSize,
- pPrinter->GetMapMode(), MapMode( MAP_100TH_MM ));
- aPageSize = awt::Size( aTmpSize.Width(), aTmpSize.Height() );
+ // which may cause vcl to set that page size on the printer
+ // (if available and not overriden by the user)
+ aTmpSize = pDoc->GetPageSize( nPage, bIsSkipEmptyPages );
+ aPreferredPageSize = awt::Size ( TWIP_TO_MM100( 2 * aTmpSize.Width() ),
+ TWIP_TO_MM100( aTmpSize.Height() ));
}
}
}
else
{
- aTmpSize = pDoc->GetPageSize( USHORT(nRenderer + 1), bIsSkipEmptyPages );
+ aTmpSize = pDoc->GetPageSize( nPage, bIsSkipEmptyPages );
aPageSize = awt::Size ( TWIP_TO_MM100( aTmpSize.Width() ),
TWIP_TO_MM100( aTmpSize.Height() ));
}
+ sal_Int32 nLen = 2;
aRenderer.realloc(2);
aRenderer[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) );
aRenderer[0].Value <<= aPageSize;
aRenderer[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageIncludesNonprintableArea" ) );
aRenderer[1].Value <<= sal_True;
+ if (aPreferredPageSize.Width && aPreferredPageSize.Height)
+ {
+ ++nLen;
+ aRenderer.realloc( nLen );
+ aRenderer[ nLen - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PreferredPageSize" ) );
+ aRenderer[ nLen - 1 ].Value <<= aPreferredPageSize;
+ }
+ if (nPrinterPaperTray >= 0)
+ {
+ ++nLen;
+ aRenderer.realloc( nLen );
+ aRenderer[ nLen - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PrinterPaperTray" ) );
+ aRenderer[ nLen - 1 ].Value <<= nPrinterPaperTray;
+ }
}
m_pPrintUIOptions->appendPrintUIOptions( aRenderer );
@@ -2908,7 +2937,7 @@ SfxViewShell * SwXTextDocument::GuessViewShell(
SwView *pSwView = 0;
SwPagePreView *pSwPagePreView = 0;
SwSrcView *pSwSrcView = 0;
- SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, 0, sal_False );
+ SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, sal_False );
// look for the view shell with the same controller in use,
// otherwise look for a suitable view, preferably a SwView,
@@ -2927,7 +2956,7 @@ SfxViewShell * SwXTextDocument::GuessViewShell(
}
else if (pSwView || pSwSrcView)
break;
- pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, 0, sal_False );
+ pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, sal_False );
}
DBG_ASSERT( pSwView || pSwPagePreView || pSwSrcView, "failed to get view shell" );
@@ -3075,6 +3104,12 @@ void SAL_CALL SwXTextDocument::render(
{
lcl_DisposeView( m_pHiddenViewFrame, pDocShell );
m_pHiddenViewFrame = 0;
+
+ // prevent crash described in #i108805
+ SwDocShell *pRenderDocShell = pDoc->GetDocShell();
+ SfxItemSet *pSet = pRenderDocShell->GetMedium()->GetItemSet();
+ pSet->Put( SfxBoolItem( SID_HIDDEN, sal_False ) );
+
}
}
}
diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx
index 736304e6aefb..0504fb1107ad 100644
--- a/sw/source/ui/uno/unotxvw.cxx
+++ b/sw/source/ui/uno/unotxvw.cxx
@@ -905,13 +905,13 @@ void SAL_CALL SwXTextView::setRubyList(
-----------------------------------------------------------------------*/
SfxObjectShellRef SwXTextView::BuildTmpSelectionDoc( SfxObjectShellRef& /*rRef*/ )
{
- SwWrtShell* pOldSh = &m_pView->GetWrtShell();
- SfxPrinter *pPrt = pOldSh->getIDocumentDeviceAccess()->getPrinter( false );
+ SwWrtShell& rOldSh = m_pView->GetWrtShell();
+ SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess()->getPrinter( false );
SwDocShell* pDocSh;
SfxObjectShellRef xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SFX_CREATE_MODE_STANDARD ) );
xDocSh->DoInitNew( 0 );
- pOldSh->FillPrtDoc(pDocSh->GetDoc(), pPrt);
- SfxViewFrame* pDocFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE );
+ rOldSh.FillPrtDoc(pDocSh->GetDoc(), pPrt);
+ SfxViewFrame* pDocFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
SwView* pDocView = (SwView*) pDocFrame->GetViewShell();
pDocView->AttrChangedNotify( &pDocView->GetWrtShell() );//Damit SelectShell gerufen wird.
SwWrtShell* pSh = pDocView->GetWrtShellPtr();
@@ -919,22 +919,19 @@ SfxObjectShellRef SwXTextView::BuildTmpSelectionDoc( SfxObjectShellRef& /*rRef*/
IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess();
SfxPrinter* pTempPrinter = pIDDA->getPrinter( true );
- if( pOldSh )
- {
- const SwPageDesc& rCurPageDesc = pOldSh->GetPageDesc(pOldSh->GetCurPageDesc());
-
- IDocumentDeviceAccess* pIDDA_old = pOldSh->getIDocumentDeviceAccess();
+ const SwPageDesc& rCurPageDesc = rOldSh.GetPageDesc(rOldSh.GetCurPageDesc());
- if( pIDDA_old->getPrinter( false ) )
- {
- pIDDA->setJobsetup( *pIDDA_old->getJobsetup() );
- //#69563# if it isn't the same printer then the pointer has been invalidated!
- pTempPrinter = pIDDA->getPrinter( true );
- }
+ IDocumentDeviceAccess* pIDDA_old = rOldSh.getIDocumentDeviceAccess();
- pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue());
+ if( pIDDA_old->getPrinter( false ) )
+ {
+ pIDDA->setJobsetup( *pIDDA_old->getJobsetup() );
+ //#69563# if it isn't the same printer then the pointer has been invalidated!
+ pTempPrinter = pIDDA->getPrinter( true );
}
+ pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue());
+
return xDocSh;
}
diff --git a/sw/source/ui/utlui/attrdesc.cxx b/sw/source/ui/utlui/attrdesc.cxx
index 06c1a580a73f..418ea4a4559b 100644
--- a/sw/source/ui/utlui/attrdesc.cxx
+++ b/sw/source/ui/utlui/attrdesc.cxx
@@ -683,13 +683,13 @@ SfxItemPresentation SwFmtAnchor::GetPresentation
switch ( GetAnchorId() )
{
case FLY_AT_PARA:
- nId = STR_FLY_AT_CNTNT;
+ nId = STR_FLY_AT_PARA;
break;
case FLY_AS_CHAR:
- nId = STR_FLY_IN_CNTNT;
+ nId = STR_FLY_AS_CHAR;
break;
case FLY_AT_PAGE:
- nId = STR_FLY_PAGE;
+ nId = STR_FLY_AT_PAGE;
break;
default:;//prevent warning
}
diff --git a/sw/source/ui/utlui/attrdesc.hrc b/sw/source/ui/utlui/attrdesc.hrc
index a750750566f3..1f2c5d34fa37 100644
--- a/sw/source/ui/utlui/attrdesc.hrc
+++ b/sw/source/ui/utlui/attrdesc.hrc
@@ -55,9 +55,9 @@
#define STR_FRM_WIDTH (RC_ATTR_BEGIN + 23)
#define STR_FRM_FIXEDHEIGHT (RC_ATTR_BEGIN + 24)
#define STR_FRM_MINHEIGHT (RC_ATTR_BEGIN + 25)
-#define STR_FLY_AT_CNTNT (RC_ATTR_BEGIN + 26)
-#define STR_FLY_IN_CNTNT (RC_ATTR_BEGIN + 27)
-#define STR_FLY_PAGE (RC_ATTR_BEGIN + 28)
+#define STR_FLY_AT_PARA (RC_ATTR_BEGIN + 26)
+#define STR_FLY_AS_CHAR (RC_ATTR_BEGIN + 27)
+#define STR_FLY_AT_PAGE (RC_ATTR_BEGIN + 28)
#define STR_POS_X (RC_ATTR_BEGIN + 29)
#define STR_POS_Y (RC_ATTR_BEGIN + 30)
#define STR_VERT_TOP (RC_ATTR_BEGIN + 31)
diff --git a/sw/source/ui/utlui/attrdesc.src b/sw/source/ui/utlui/attrdesc.src
index f1602efcacd8..809af110da6f 100644
--- a/sw/source/ui/utlui/attrdesc.src
+++ b/sw/source/ui/utlui/attrdesc.src
@@ -148,15 +148,15 @@ String STR_FRM_MINHEIGHT
/* ### ACHTUNG: Neuer Text in Resource? min. Hhe: : min. Hhe: */
Text [ en-US ] = "Min. height:" ;
};
-String STR_FLY_AT_CNTNT
+String STR_FLY_AT_PARA
{
Text [ en-US ] = "to paragraph" ;
};
-String STR_FLY_IN_CNTNT
+String STR_FLY_AS_CHAR
{
Text [ en-US ] = "to character" ;
};
-String STR_FLY_PAGE
+String STR_FLY_AT_PAGE
{
Text [ en-US ] = "to page" ;
};
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index 9be4ef6eadf3..0b0bca564f48 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -106,7 +106,6 @@
#include <swundo.hxx>
#include <ndtxt.hxx>
#include <PostItMgr.hxx>
-#include <postit.hxx>
#include <postithelper.hxx>
#include <redline.hxx>
#include <docary.hxx>
@@ -335,7 +334,8 @@ void SwContentType::Init(sal_Bool* pbInvalidateWindow)
(eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
&& TOX_HEADER_SECTION != eTmpType )
{
- const String& rSectionName = pFmt->GetSection()->GetName();
+ const String& rSectionName =
+ pFmt->GetSection()->GetSectionName();
BYTE nLevel = 0;
SwSectionFmt* pParentFmt = pFmt->GetParent();
while(pParentFmt)
@@ -697,7 +697,7 @@ void SwContentType::FillMemberList(sal_Bool* pbLevelOrVisibiblityChanged)
(eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
&& TOX_HEADER_SECTION != eTmpType )
{
- String sSectionName = pFmt->GetSection()->GetName();
+ String sSectionName = pFmt->GetSection()->GetSectionName();
BYTE nLevel = 0;
SwSectionFmt* pParentFmt = pFmt->GetParent();
@@ -2670,7 +2670,7 @@ void SwContentTree::ExcecuteContextMenuAction( USHORT nSelectedPopupEntry )
break;
case 602:
{
- pActiveShell->GetView().GetPostItMgr()->SetActivePostIt(0);
+ pActiveShell->GetView().GetPostItMgr()->SetActiveSidebarWin(0);
pActiveShell->GetView().GetPostItMgr()->Delete();
break;
}
@@ -2932,7 +2932,7 @@ void SwContentTree::EditEntry(SvLBoxEntry* pEntry, sal_uInt8 nMode)
{
if (((SwPostItContent*)pCnt)->IsPostIt())
{
- pActiveShell->GetView().GetPostItMgr()->SetActivePostIt(0);
+ pActiveShell->GetView().GetPostItMgr()->SetActiveSidebarWin(0);
pActiveShell->DelRight();
}
/*
@@ -3140,7 +3140,7 @@ void SwContentTree::GotoContent(SwContent* pCnt)
}
SwView& rView = pActiveShell->GetView();
rView.StopShellTimer();
- rView.GetPostItMgr()->SetActivePostIt(0);
+ rView.GetPostItMgr()->SetActiveSidebarWin(0);
rView.GetEditWin().GrabFocus();
}
/*-----------------06.02.97 19.14-------------------
diff --git a/sw/source/ui/utlui/glbltree.cxx b/sw/source/ui/utlui/glbltree.cxx
index fea4b72462e3..e9b8fdf6feef 100644
--- a/sw/source/ui/utlui/glbltree.cxx
+++ b/sw/source/ui/utlui/glbltree.cxx
@@ -32,18 +32,14 @@
#define _SVSTDARR_STRINGSDTOR
#include <svl/svstdarr.hxx>
#endif
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <svl/stritem.hxx>
#include <sfx2/fcontnr.hxx>
#include <sfx2/linkmgr.hxx>
#include <sfx2/dispatch.hxx>
#include <svl/urihelper.hxx>
#include <sfx2/docfile.hxx>
-#ifndef _HELP_HXX //autogen
#include <vcl/help.hxx>
-#endif
#include <sot/filelist.hxx>
#include <svl/eitem.hxx>
#include <svl/urlbmk.hxx>
@@ -54,13 +50,9 @@
#include <sfx2/app.hxx>
#include <swmodule.hxx>
#include <wrtsh.hxx>
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
#include <errhdl.hxx>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <content.hxx>
#include <edglbldc.hxx>
#include <section.hxx>
@@ -72,12 +64,8 @@
#include <edtwin.hxx>
#include <uitool.hxx>
-#ifndef _CMDID_H
#include <cmdid.h>
-#endif
-#ifndef _HELPID_H
#include <helpid.h>
-#endif
#ifndef _NAVIPI_HRC
#include <navipi.hrc>
#endif
@@ -779,7 +767,7 @@ void SwGlobalTree::Display(BOOL bOnlyUpdateUserData)
case GLBLDOC_SECTION:
{
const SwSection* pSect = pCont->GetSection();
- sEntry = pSect->GetName();
+ sEntry = pSect->GetSectionName();
aImage = aEntryImages.GetImage(SID_SW_START + CONTENT_TYPE_REGION);
}
break;
@@ -947,7 +935,8 @@ void SwGlobalTree::ExcecuteContextMenuAction( USHORT nSelectedPopupEntry )
case CTX_EDIT_LINK:
{
DBG_ASSERT(pCont, "Edit ohne Entry ? " );
- SfxStringItem aName(FN_EDIT_REGION, pCont->GetSection()->GetName());
+ SfxStringItem aName(FN_EDIT_REGION,
+ pCont->GetSection()->GetSectionName());
rDispatch.Execute(FN_EDIT_REGION, SFX_CALLMODE_ASYNCHRON, &aName, 0L);
}
break;
@@ -1254,7 +1243,7 @@ BOOL SwGlobalTree::Update(BOOL bHard)
String sTemp = GetEntryText(pEntry);
if(eType != pRight->GetType() ||
eType == GLBLDOC_SECTION &&
- pLeft->GetSection()->GetName() != sTemp ||
+ (pLeft->GetSection()->GetSectionName() != sTemp) ||
eType == GLBLDOC_TOXBASE && pLeft->GetTOX()->GetTitle() != sTemp)
bCopy = bRet = TRUE;
}
@@ -1456,7 +1445,8 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequen
while ( nCount < nSectCount )
{
const SwSectionFmt& rFmt = rSh.GetSectionFmt(nCount);
- if ( rFmt.GetSection()->GetName() == sTempSectionName && rFmt.IsInNodesArr() )
+ if ((rFmt.GetSection()->GetSectionName() == sTempSectionName)
+ && rFmt.IsInNodesArr())
{
nCount = 0;
nAddNumber++;
@@ -1471,15 +1461,15 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequen
if ( nAddNumber )
sSectionName = sTempSectionName;
- SwSection aSection(CONTENT_SECTION, sSectionName);
- aSection.SetProtect(TRUE);
- aSection.SetHidden(FALSE);
+ SwSectionData aSectionData(CONTENT_SECTION, sSectionName);
+ aSectionData.SetProtectFlag(true);
+ aSectionData.SetHidden(false);
- aSection.SetLinkFileName(sFileName);
- aSection.SetType( FILE_LINK_SECTION);
- aSection.SetLinkFilePassWd( sFilePassword );
+ aSectionData.SetLinkFileName(sFileName);
+ aSectionData.SetType(FILE_LINK_SECTION);
+ aSectionData.SetLinkFilePassword( sFilePassword );
- rSh.InsertGlobalDocContent( *pAnchorContent, aSection );
+ rSh.InsertGlobalDocContent( *pAnchorContent, aSectionData );
}
if ( bMove )
{
diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx
index a2d0d2cdf2d3..ea43533f70d8 100644
--- a/sw/source/ui/utlui/navipi.cxx
+++ b/sw/source/ui/utlui/navipi.cxx
@@ -500,7 +500,7 @@ void SwNavigationPI::CreateNavigationTool(const Rectangle& rRect, BOOL bSetFocus
{
// SfxBindings& rBind = GetCreateView()->GetViewFrame()->GetBindings();
// rBind.ENTERREGISTRATIONS();
- Reference< XFrame > xFrame = GetCreateView()->GetViewFrame()->GetFrame()->GetFrameInterface();
+ Reference< XFrame > xFrame = GetCreateView()->GetViewFrame()->GetFrame().GetFrameInterface();
SwScrollNaviPopup* pPopup = new
SwScrollNaviPopup(FN_SCROLL_NAVIGATION,
xFrame );
diff --git a/sw/source/ui/utlui/numfmtlb.cxx b/sw/source/ui/utlui/numfmtlb.cxx
index 58e332ccbc45..baf059c51c32 100644
--- a/sw/source/ui/utlui/numfmtlb.cxx
+++ b/sw/source/ui/utlui/numfmtlb.cxx
@@ -435,7 +435,7 @@ IMPL_LINK( NumFormatListBox, SelectHdl, ListBox *, pBox )
DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aCoreSet,
- GetView()->GetViewFrame()->GetFrame()->GetFrameInterface(),
+ GetView()->GetViewFrame()->GetFrame().GetFrameInterface(),
RC_DLG_SWNUMFMTDLG );
DBG_ASSERT(pDlg, "Dialogdiet fail!");
diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx
index facc83c6a0a9..01f6c4e84d7a 100644
--- a/sw/source/ui/utlui/uitool.cxx
+++ b/sw/source/ui/utlui/uitool.cxx
@@ -756,7 +756,7 @@ bool ExecuteMenuCommand( PopupMenu& rMenu, SfxViewFrame& rViewFrame, USHORT nId
}
if(sCommand.Len())
{
- uno::Reference< frame::XFrame > xFrame = rViewFrame.GetFrame()->GetFrameInterface();
+ uno::Reference< frame::XFrame > xFrame = rViewFrame.GetFrame().GetFrameInterface();
uno::Reference < frame::XDispatchProvider > xProv( xFrame, uno::UNO_QUERY );
util::URL aURL;
aURL.Complete = sCommand;
diff --git a/sw/source/ui/vba/vbafind.cxx b/sw/source/ui/vba/vbafind.cxx
index 79112109bf8c..fccf04181993 100644
--- a/sw/source/ui/vba/vbafind.cxx
+++ b/sw/source/ui/vba/vbafind.cxx
@@ -80,13 +80,13 @@ void SwVbaFind::SetReplace( sal_Int32 type )
mnReplaceType = type;
mbReplace = sal_True;
}
-
+#ifdef TOMORROW
rtl::OUString SwVbaFind::ReplaceWildcards( const rtl::OUString& /*rText*/ ) throw ( uno::RuntimeException )
{
// TODO:
return rtl::OUString();
}
-
+#endif
uno::Reference< text::XTextRange > SwVbaFind::FindOneElement() throw ( uno::RuntimeException )
{
uno::Reference< text::XTextRange > xFoundOne;
diff --git a/sw/source/ui/vba/vbafind.hxx b/sw/source/ui/vba/vbafind.hxx
index 1252050c7823..ef971866500d 100644
--- a/sw/source/ui/vba/vbafind.hxx
+++ b/sw/source/ui/vba/vbafind.hxx
@@ -58,7 +58,9 @@ private:
void SetReplace( sal_Int32 type );
void SetReplaceWith( const rtl::OUString& rText ) throw ( css::uno::RuntimeException );
rtl::OUString GetReplaceWith() throw ( css::uno::RuntimeException );
+#ifdef TOMORROW
rtl::OUString ReplaceWildcards( const rtl::OUString& rText ) throw ( css::uno::RuntimeException );
+#endif
css::uno::Reference< css::text::XTextRange > FindOneElement() throw ( css::uno::RuntimeException );
sal_Bool SearchReplace() throw ( css::uno::RuntimeException );
diff --git a/sw/source/ui/vba/vbaheaderfooterhelper.cxx b/sw/source/ui/vba/vbaheaderfooterhelper.cxx
index 240bba8d900b..604cc1e11d8c 100644
--- a/sw/source/ui/vba/vbaheaderfooterhelper.cxx
+++ b/sw/source/ui/vba/vbaheaderfooterhelper.cxx
@@ -155,7 +155,7 @@ sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XMo
}
return sal_False;
}
-
+#ifdef TOMORROW
sal_Bool HeaderFooterHelper::isPrimaryHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
{
if( isHeader( xModel, xCurrentText ) )
@@ -173,3 +173,4 @@ sal_Bool HeaderFooterHelper::isPrimaryFooter( const uno::Reference< frame::XMode
}
return sal_False;
}
+#endif
diff --git a/sw/source/ui/vba/vbaheaderfooterhelper.hxx b/sw/source/ui/vba/vbaheaderfooterhelper.hxx
index 30f4a0222549..fd29a16015ab 100644
--- a/sw/source/ui/vba/vbaheaderfooterhelper.hxx
+++ b/sw/source/ui/vba/vbaheaderfooterhelper.hxx
@@ -42,8 +42,10 @@ public:
static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
+#ifdef TOMORROW
static sal_Bool isPrimaryHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
static sal_Bool isPrimaryFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
+#endif
};
#endif
diff --git a/sw/source/ui/vba/vbarange.cxx b/sw/source/ui/vba/vbarange.cxx
index 2f1ee48ec5ef..647aedb34791 100644
--- a/sw/source/ui/vba/vbarange.cxx
+++ b/sw/source/ui/vba/vbarange.cxx
@@ -84,13 +84,13 @@ SwVbaRange::getXTextRange() throw (uno::RuntimeException)
uno::Reference< text::XTextRange > xTextRange( mxTextCursor, uno::UNO_QUERY_THROW );
return xTextRange;
}
-
+#ifdef TOMORROW
void SwVbaRange::setXTextRange( const uno::Reference< text::XTextRange >& xRange ) throw (uno::RuntimeException)
{
mxTextCursor->gotoRange( xRange->getStart(), sal_False );
mxTextCursor->gotoRange( xRange->getEnd(), sal_True );
}
-
+#endif
/**
* The complexity in this method is because we need to workaround
* an issue that the last paragraph in a document does not have a trailing CRLF.
diff --git a/sw/source/ui/vba/vbarange.hxx b/sw/source/ui/vba/vbarange.hxx
index 73992494f146..1f1b3a3bbc8b 100644
--- a/sw/source/ui/vba/vbarange.hxx
+++ b/sw/source/ui/vba/vbarange.hxx
@@ -56,7 +56,9 @@ public:
css::uno::Reference< css::text::XTextDocument > getDocument() { return mxTextDocument; }
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getXTextRange() throw (css::uno::RuntimeException);
+#ifdef TOMORROW
void setXTextRange( const css::uno::Reference< css::text::XTextRange >& xRange ) throw (css::uno::RuntimeException);
+#endif
css::uno::Reference< css::text::XText > getXText() { return mxText; }
void setXTextCursor( const css::uno::Reference< css::text::XTextCursor >& xTextCursor ) { mxTextCursor = xTextCursor; }
diff --git a/sw/source/ui/vba/vbasystem.cxx b/sw/source/ui/vba/vbasystem.cxx
index 71b2389bc96b..42d1c09ccbac 100644
--- a/sw/source/ui/vba/vbasystem.cxx
+++ b/sw/source/ui/vba/vbasystem.cxx
@@ -37,11 +37,6 @@
using namespace ::ooo::vba;
using namespace ::com::sun::star;
-PrivateProfileStringListener::PrivateProfileStringListener( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey )
- :maFileName( rFileName ), maGroupName( rGroupName ), maKey( rKey )
-{
-}
-
PrivateProfileStringListener::~PrivateProfileStringListener()
{
}
diff --git a/sw/source/ui/vba/vbasystem.hxx b/sw/source/ui/vba/vbasystem.hxx
index e11494857617..deeb6f00fdf4 100644
--- a/sw/source/ui/vba/vbasystem.hxx
+++ b/sw/source/ui/vba/vbasystem.hxx
@@ -42,7 +42,6 @@ private:
ByteString maKey;
public:
PrivateProfileStringListener(){};
- PrivateProfileStringListener( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey );
virtual ~PrivateProfileStringListener();
void Initialize( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey );
diff --git a/sw/source/ui/vba/vbawindow.cxx b/sw/source/ui/vba/vbawindow.cxx
index 519b5a5c725b..e3d9bddbc7aa 100644
--- a/sw/source/ui/vba/vbawindow.cxx
+++ b/sw/source/ui/vba/vbawindow.cxx
@@ -39,11 +39,6 @@ SwVbaWindow::SwVbaWindow( const uno::Reference< XHelperInterface >& xParent, con
{
}
-SwVbaWindow::SwVbaWindow( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xContext )
- : WindowImpl_BASE( args, xContext )
-{
-}
-
void
SwVbaWindow::Activate() throw (css::uno::RuntimeException)
{
diff --git a/sw/source/ui/vba/vbawindow.hxx b/sw/source/ui/vba/vbawindow.hxx
index 902af1b51257..0809d2b73685 100644
--- a/sw/source/ui/vba/vbawindow.hxx
+++ b/sw/source/ui/vba/vbawindow.hxx
@@ -39,7 +39,6 @@ class SwVbaWindow : public WindowImpl_BASE
{
public:
SwVbaWindow( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel );
- SwVbaWindow( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
// Attributes
diff --git a/sw/source/ui/vba/vbawrapformat.cxx b/sw/source/ui/vba/vbawrapformat.cxx
index 92e3e78790a0..4125cc00aaa0 100644
--- a/sw/source/ui/vba/vbawrapformat.cxx
+++ b/sw/source/ui/vba/vbawrapformat.cxx
@@ -34,11 +34,6 @@
using namespace ooo::vba;
using namespace com::sun::star;
-SwVbaWrapFormat::SwVbaWrapFormat( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : SwVbaWrapFormat_BASE( xParent, xContext ), m_xShape( xShape ), mnWrapFormatType( 0 ), mnSide( word::WdWrapSideType::wdWrapBoth )
-{
- m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW );
-}
-
SwVbaWrapFormat::SwVbaWrapFormat( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) : SwVbaWrapFormat_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext ), m_xShape( getXSomethingFromArgs< drawing::XShape >( aArgs, 1, false ) ), mnWrapFormatType( 0 ), mnSide( word::WdWrapSideType::wdWrapBoth )
{
m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW );
diff --git a/sw/source/ui/vba/vbawrapformat.hxx b/sw/source/ui/vba/vbawrapformat.hxx
index e24f2b90ac42..71520d78aaae 100644
--- a/sw/source/ui/vba/vbawrapformat.hxx
+++ b/sw/source/ui/vba/vbawrapformat.hxx
@@ -47,7 +47,6 @@ private:
void setDistance( const rtl::OUString& sName, float _distance ) throw (css::uno::RuntimeException);
public:
- SwVbaWrapFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape );
SwVbaWrapFormat( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
index 389f6eac69e3..c7cb89bf5e61 100644
--- a/sw/source/ui/wrtsh/wrtsh1.cxx
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -644,7 +644,7 @@ BOOL SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrmFm
void SwWrtShell::LaunchOLEObj( long nVerb )
{
if ( GetCntType() == CNT_OLE &&
- !GetView().GetViewFrame()->GetFrame()->IsInPlace() )
+ !GetView().GetViewFrame()->GetFrame().IsInPlace() )
{
svt::EmbeddedObjectRef& xRef = GetOLEObject();
ASSERT( xRef.is(), "OLE not found" );
@@ -1378,10 +1378,13 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
if ( pTxtNode &&
ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
{
- short nTxtNodeFirstLineOffset( 0 );
- pTxtNode->GetFirstLineOfsWithNum( nTxtNodeFirstLineOffset );
- const SwTwips nTxtNodeIndent = pTxtNode->GetLeftMarginForTabCalculation() +
- nTxtNodeFirstLineOffset;
+ // --> OD 2010-01-05 #b6884103#
+// short nTxtNodeFirstLineOffset( 0 );
+// pTxtNode->GetFirstLineOfsWithNum( nTxtNodeFirstLineOffset );
+// const SwTwips nTxtNodeIndent = pTxtNode->GetLeftMarginForTabCalculation() +
+// nTxtNodeFirstLineOffset;
+ const SwTwips nTxtNodeIndent = pTxtNode->GetAdditionalIndentForStartingNewList();
+ // <--
if ( ( nTxtNodeIndent + nWidthOfTabs ) != 0 )
{
const SwTwips nIndentChange = nTxtNodeIndent + nWidthOfTabs;
@@ -1473,7 +1476,7 @@ SelectionType SwWrtShell::GetSelectionType() const
// return nsSelectionType::SEL_TBL | nsSelectionType::SEL_TBL_CELLS;
SwView &_rView = ((SwView&)GetView());
- if (_rView.GetPostItMgr() && _rView.GetPostItMgr()->GetActivePostIt() )
+ if (_rView.GetPostItMgr() && _rView.GetPostItMgr()->HasActiveSidebarWin() )
return nsSelectionType::SEL_POSTIT;
int nCnt;
@@ -1805,7 +1808,7 @@ BOOL SwWrtShell::Pop( BOOL bOldCrsr )
--------------------------------------------------------------------*/
BOOL SwWrtShell::CanInsert()
{
- return (!(IsSelFrmMode() | IsObjSelected() | (GetView().GetDrawFuncPtr() != NULL) | (GetView().GetPostItMgr()->GetActivePostIt()!= NULL)));
+ return (!(IsSelFrmMode() | IsObjSelected() | (GetView().GetDrawFuncPtr() != NULL) | (GetView().GetPostItMgr()->GetActiveSidebarWin()!= NULL)));
}
// die Core erzeugt eine Selektion, das SttSelect muss gerufen werden
diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx
index 4d0172a5461b..17af61be8bad 100644
--- a/sw/source/ui/wrtsh/wrtsh2.cxx
+++ b/sw/source/ui/wrtsh/wrtsh2.cxx
@@ -468,20 +468,20 @@ void SwWrtShell::NavigatorPaste( const NaviContentBookmark& rBkmk,
}
else
{
- SwSection aSection( FILE_LINK_SECTION, GetUniqueSectionName( 0 ) );
+ SwSectionData aSection( FILE_LINK_SECTION, GetUniqueSectionName( 0 ) );
String aLinkFile( rBkmk.GetURL().GetToken(0, '#') );
aLinkFile += sfx2::cTokenSeperator;
aLinkFile += sfx2::cTokenSeperator;
aLinkFile += rBkmk.GetURL().GetToken(1, '#');
aSection.SetLinkFileName( aLinkFile );
- aSection.SetProtect( TRUE );
+ aSection.SetProtectFlag( true );
const SwSection* pIns = InsertSection( aSection );
if( EXCHG_IN_ACTION_MOVE == nAction && pIns )
{
- aSection = *pIns;
+ aSection = SwSectionData(*pIns);
aSection.SetLinkFileName( aEmptyStr );
aSection.SetType( CONTENT_SECTION );
- aSection.SetProtect( FALSE );
+ aSection.SetProtectFlag( false );
// the update of content from linked section at time delete
// the undostack. Then the change of the section dont create
@@ -489,7 +489,7 @@ void SwWrtShell::NavigatorPaste( const NaviContentBookmark& rBkmk,
BOOL bDoesUndo = DoesUndo();
if( UNDO_INSSECTION != GetUndoIds() )
DoUndo( FALSE );
- ChgSection( GetSectionFmtPos( *pIns->GetFmt() ), aSection );
+ UpdateSection( GetSectionFmtPos( *pIns->GetFmt() ), aSection );
DoUndo( bDoesUndo );
}
}