summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-06-06 15:13:26 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-06-09 09:23:58 +0100
commit7e600aca08ebbd69b0c8ef924c84af4dcf80df56 (patch)
tree535e875bd16b69a530b8af85fc2b7f73993d757d
parent5d1e22d52a659b12fe7f6b5870bd12d07ddca0d8 (diff)
Related: fdo#78151 force outliners in master view to be read-only text
because these contain place-holder text and it doesn't make sense to be able to edit them (unless some-day we support custom place-holder prompts) because they are now read-only add a pair of "show next level" and "hide last level" features so on right clicking the last outline paragraph you can make the next one visible, or make the last one invisible Change-Id: Iea24d810f298156cfe2f32aa53d0515da45e08eb
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu10
-rw-r--r--sd/inc/app.hrc5
-rw-r--r--sd/inc/sdcommands.h2
-rw-r--r--sd/sdi/_drvwsh.sdi10
-rw-r--r--sd/sdi/sdraw.sdi48
-rw-r--r--sd/source/ui/app/popup.src13
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx6
-rw-r--r--sd/source/ui/inc/View.hxx19
-rw-r--r--sd/source/ui/view/drviews2.cxx50
-rw-r--r--sd/source/ui/view/drviews7.cxx66
-rw-r--r--sd/source/ui/view/sdview.cxx30
11 files changed, 255 insertions, 4 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
index b4b63665cd5b..31aa4d7f9e18 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
@@ -584,6 +584,16 @@
<value xml:lang="en-US">H~yperlink...</value>
</prop>
</node>
+ <node oor:name=".uno:HideLastLevel" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">~Hide Last Level</value>
+ </prop>
+ </node>
+ <node oor:name=".uno:ShowNextLevel" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">~Show Next Level</value>
+ </prop>
+ </node>
<node oor:name=".uno:PageSetup" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">~Page...</value>
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index ef8631f9e662..fae13da62b67 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -447,9 +447,10 @@
#define SID_ADD_MOTION_PATH (SID_SD_START+442)
#define SID_TABLE_TOOLBOX (SID_SD_START+443)
-
// free
-#define SID_PRESENTATION_MINIMIZER (SID_SD_START+450)
+#define SID_HIDE_LAST_LEVEL (SID_SD_START+448)
+#define SID_SHOW_NEXT_LEVEL (SID_SD_START+449)
+#define SID_PRESENTATION_MINIMIZER (SID_SD_START+450)
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/inc/sdcommands.h b/sd/inc/sdcommands.h
index 2041d8f37e2e..276bf6dd62c6 100644
--- a/sd/inc/sdcommands.h
+++ b/sd/inc/sdcommands.h
@@ -119,6 +119,8 @@
#define CMD_SID_INSERTPAGE_LAYOUT_MENU ".uno:TaskPaneInsertPage"
#define CMD_SID_PHOTOALBUM ".uno:PhotoAlbumDialog"
#define CMD_SID_PRESENTATION_MINIMIZER ".uno:PresentationMinimizer"
+#define CMD_SID_HIDE_LAST_LEVEL ".uno:HideLastLevel"
+#define CMD_SID_SHOW_NEXT_LEVEL ".uno:ShowNextLevel"
#endif
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index d328cf42e57a..f8119e9356c8 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -2309,6 +2309,16 @@ interface DrawView
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
+ SID_HIDE_LAST_LEVEL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
+ SID_SHOW_NEXT_LEVEL // ole : no, status : ?
+ [
+ ExecMethod = FuTemporary ;
+ StateMethod = GetMenuState ;
+ ]
SID_TRANSLITERATE_UPPER // ole : no, status : ?
[
ExecMethod = FuSupport ;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 9a03c4f20996..de7f1a284c8c 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -7025,3 +7025,51 @@ SfxVoidItem PresentationMinimizer SID_PRESENTATION_MINIMIZER
ToolBoxConfig = TRUE,
GroupId = GID_OPTIONS;
]
+
+SfxVoidItem HideLastLevel SID_HIDE_LAST_LEVEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_OPTIONS;
+]
+
+SfxVoidItem ShowNextLevel SID_SHOW_NEXT_LEVEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_OPTIONS;
+]
diff --git a/sd/source/ui/app/popup.src b/sd/source/ui/app/popup.src
index 7f8692f35924..1fd556133508 100644
--- a/sd/source/ui/app/popup.src
+++ b/sd/source/ui/app/popup.src
@@ -33,6 +33,19 @@ Menu RID_DRAW_TEXTOBJ_INSIDE_POPUP
{
ItemList =
{
+ MenuItem
+ {
+ Identifier = SID_HIDE_LAST_LEVEL;
+ Command = CMD_SID_HIDE_LAST_LEVEL;
+ Text [ en-US ] = "~Hide Last Level";
+ };
+ MenuItem
+ {
+ Identifier = SID_SHOW_NEXT_LEVEL;
+ Command = CMD_SID_SHOW_NEXT_LEVEL;
+ Text [ en-US ] = "~Show Next Level";
+ };
+ SEPARATOR
MN_SET_DEFAULT
SEPARATOR
MN_TEXTATTR
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 5c4a63344611..fe2faa50ddc0 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -31,6 +31,7 @@
#include <com/sun/star/scanner/XScannerManager2.hpp>
#include <unotools/caserotate.hxx>
+class Outliner;
class SdPage;
class DrawDocShell;
class TabBar;
@@ -41,6 +42,7 @@ class TransferableClipboardListener;
class AbstractSvxNameDialog;
class SdrLayer;
class SvxClipboardFmtItem;
+struct ESelection;
namespace sd {
@@ -161,6 +163,10 @@ public:
virtual OUString GetSelectionText( bool bCompleteWords = false );
virtual bool HasSelection( bool bText = true ) const;
+ //If we are editing an PRESOBJ_OUTLINE return the Outliner and fill rSel
+ //with the current selection
+ ::Outliner* GetOutlinerForMasterPageOutlineTextObj(ESelection &rSel);
+
void ExecCtrl(SfxRequest& rReq);
void GetCtrlState(SfxItemSet& rSet);
void GetDrawAttrState(SfxItemSet& rSet);
diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx
index 672342b08487..80dd74e77716 100644
--- a/sd/source/ui/inc/View.hxx
+++ b/sd/source/ui/inc/View.hxx
@@ -63,6 +63,24 @@ struct SdViewRedrawRec
Rectangle aRect;
};
+//For master view we want to force that master
+//textboxes have readonly text, because the
+//text is the auto-generated click-here-to-edit
+//and it doesn't help to change it
+class OutlinerMasterViewFilter
+{
+private:
+ SdrOutliner *m_pOutl;
+ bool m_bReadOnly;
+public:
+ OutlinerMasterViewFilter()
+ : m_pOutl(0)
+ , m_bReadOnly(false)
+ {
+ }
+ void Start(SdrOutliner *pOutl);
+ void End();
+};
class View : public FmFormView
{
@@ -272,6 +290,7 @@ protected:
private:
::std::auto_ptr<ViewClipboard> mpClipboard;
+ OutlinerMasterViewFilter maMasterViewFilter;
};
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index bd7c4bfef6fd..2c42638a8cf1 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1815,6 +1815,56 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
}
break;
+ case SID_HIDE_LAST_LEVEL:
+ {
+ ESelection aSel;
+ // fdo#78151 editing a PRESOBJ_OUTLINE in a master page ?
+ ::Outliner* pOL = GetOutlinerForMasterPageOutlineTextObj(aSel);
+ if (pOL)
+ {
+ //we are on the last paragraph
+ aSel.Adjust();
+ if (aSel.nEndPara == pOL->GetParagraphCount() - 1)
+ {
+ sal_uInt16 nDepth = pOL->GetDepth(aSel.nEndPara);
+ //there exists a previous numbering level
+ if (nDepth != sal_uInt16(-1) && nDepth > 0)
+ {
+ Paragraph* pPara = pOL->GetParagraph(aSel.nEndPara);
+ pOL->Remove(pPara, 1);
+ }
+ }
+ }
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
+ case SID_SHOW_NEXT_LEVEL:
+ {
+ ESelection aSel;
+ // fdo#78151 editing a PRESOBJ_OUTLINE in a master page ?
+ ::Outliner* pOL = GetOutlinerForMasterPageOutlineTextObj(aSel);
+ if (pOL)
+ {
+ //we are on the last paragraph
+ aSel.Adjust();
+ if (aSel.nEndPara == pOL->GetParagraphCount() - 1)
+ {
+ sal_uInt16 nDepth = pOL->GetDepth(aSel.nEndPara);
+ //there exists a previous numbering level
+ if (nDepth != sal_uInt16(-1) && nDepth < 8)
+ {
+ sal_uInt16 nNewDepth = nDepth+1;
+ pOL->Insert(SD_RESSTR(STR_PRESOBJ_MPOUTLINE+nNewDepth), EE_PARA_APPEND, nNewDepth);
+ }
+ }
+ }
+ Cancel();
+ rReq.Done ();
+ }
+ break;
+
case SID_INSERT_FLD_DATE_FIX:
case SID_INSERT_FLD_DATE_VAR:
case SID_INSERT_FLD_TIME_FIX:
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index b0bec1dfd256..06d60f676789 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -210,6 +210,37 @@ void DrawViewShell::GetDrawAttrState(SfxItemSet& rSet)
rSet.Put(aSet,false);
}
+::Outliner* DrawViewShell::GetOutlinerForMasterPageOutlineTextObj(ESelection &rSel)
+{
+ if( !mpDrawView )
+ return NULL;
+
+ //when there is one object selected
+ if (!mpDrawView->AreObjectsMarked() || (mpDrawView->GetMarkedObjectList().GetMarkCount() != 1))
+ return NULL;
+
+ //and we are editing the outline object
+ if (!mpDrawView->IsTextEdit())
+ return NULL;
+
+ SdrPageView* pPageView = mpDrawView->GetSdrPageView();
+ if (!pPageView)
+ return NULL;
+
+ SdPage* pPage = (SdPage*)pPageView->GetPage();
+ //only show these in a normal master page
+ if (!pPage || (pPage->GetPageKind() != PK_STANDARD) || !pPage->IsMasterPage())
+ return NULL;
+
+ OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
+ ::Outliner* pOL = pOLV ? pOLV->GetOutliner() : NULL;
+ if (!pOL)
+ return NULL;
+ rSel = pOLV->GetSelection();
+
+ return pOL;
+}
+
void DrawViewShell::GetMenuState( SfxItemSet &rSet )
{
if (mpDrawView == NULL)
@@ -1563,6 +1594,41 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
if ( bDisableEditHyperlink )
rSet.DisableItem( SID_OPEN_HYPERLINK );
+ //fdo#78151 enable show next level/hide last level if editing a master page
+ //PRESOBJ_OUTLINE object and the current selection allow that to happen
+ {
+ bool bDisableShowNextLevel = true;
+ bool bDisableHideLastLevel = true;
+
+ ESelection aSel;
+ ::Outliner* pOL = GetOutlinerForMasterPageOutlineTextObj(aSel);
+ if (pOL)
+ {
+ //and are on the last paragraph
+ aSel.Adjust();
+ if (aSel.nEndPara == pOL->GetParagraphCount() - 1)
+ {
+ sal_uInt16 nDepth = pOL->GetDepth(aSel.nEndPara);
+ if (nDepth != sal_uInt16(-1))
+ {
+ //there exists another numbering level that
+ //is currently hidden
+ if (nDepth < 8)
+ bDisableShowNextLevel = false;
+ //there exists a previous numbering level
+ if (nDepth > 0)
+ bDisableHideLastLevel = false;
+ }
+ }
+ }
+
+ if (bDisableShowNextLevel)
+ rSet.DisableItem(SID_SHOW_NEXT_LEVEL);
+
+ if (bDisableHideLastLevel)
+ rSet.DisableItem(SID_HIDE_LAST_LEVEL);
+ }
+
#if defined WNT || defined UNX
if( !mxScannerManager.is() )
{
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 59918f33d561..009fa7e67e52 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -654,12 +654,33 @@ static void SetSpellOptions( const SdDrawDocument& rDoc, sal_uLong& rCntrl )
rCntrl &= ~EE_CNTRL_ONLINESPELLING;
}
+void OutlinerMasterViewFilter::Start(SdrOutliner *pOutl)
+{
+ m_pOutl = pOutl;
+ OutlinerView* pOutlView = m_pOutl->GetView(0);
+ m_bReadOnly = pOutlView->IsReadOnly();
+ pOutlView->SetReadOnly(true);
+}
+
+void OutlinerMasterViewFilter::End()
+{
+ if (m_pOutl)
+ {
+ OutlinerView* pOutlView = m_pOutl->GetView(0);
+ pOutlView->SetReadOnly(m_bReadOnly);
+ m_pOutl = NULL;
+ }
+}
+
bool View::SdrBeginTextEdit(
SdrObject* pObj, SdrPageView* pPV, ::Window* pWin,
bool bIsNewObj,
SdrOutliner* pOutl, OutlinerView* pGivenOutlinerView,
bool bDontDeleteOutliner, bool bOnlyOneView, bool bGrabFocus )
{
+ SdrPage* pPage = pObj->GetPage();
+ bool bMasterPage = pPage && pPage->IsMasterPage();
+
GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(
sd::tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT, (void*)pObj );
@@ -732,12 +753,17 @@ bool View::SdrBeginTextEdit(
}
}
- return(bReturn);
+ if (bMasterPage && bReturn)
+ maMasterViewFilter.Start(pOutl);
+
+ return bReturn;
}
/** ends current text editing */
-SdrEndTextEditKind View::SdrEndTextEdit(bool bDontDeleteReally )
+SdrEndTextEditKind View::SdrEndTextEdit(bool bDontDeleteReally)
{
+ maMasterViewFilter.End();
+
SdrObjectWeakRef xObj( GetTextEditObject() );
bool bDefaultTextRestored = RestoreDefaultText( dynamic_cast< SdrTextObj* >( GetTextEditObject() ) );