2010-10-27 12:53:26 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-27 16:10:40 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2013-10-23 22:38:46 +02:00
|
|
|
#ifndef INCLUDED_SD_SOURCE_UI_INC_OUTLINEVIEW_HXX
|
|
|
|
#define INCLUDED_SD_SOURCE_UI_INC_OUTLINEVIEW_HXX
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2008-06-06 11:08:04 +00:00
|
|
|
#include <vcl/image.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/lrspitem.hxx>
|
2004-01-20 10:37:53 +00:00
|
|
|
#include "View.hxx"
|
|
|
|
|
|
|
|
class SdPage;
|
|
|
|
class SdrPage;
|
|
|
|
class Paragraph;
|
|
|
|
class SdrTextObj;
|
|
|
|
class Outliner;
|
|
|
|
class SfxProgress;
|
2008-06-06 11:08:04 +00:00
|
|
|
struct PaintFirstLineInfo;
|
|
|
|
struct PasteOrDropInfos;
|
2015-09-16 13:02:21 +02:00
|
|
|
class EditView;
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2005-04-12 15:56:04 +00:00
|
|
|
namespace sd { namespace tools {
|
|
|
|
class EventMultiplexerEvent;
|
|
|
|
} }
|
|
|
|
|
2004-01-20 10:37:53 +00:00
|
|
|
namespace sd {
|
|
|
|
|
2008-03-12 10:42:11 +00:00
|
|
|
class DrawDocShell;
|
2004-01-20 10:37:53 +00:00
|
|
|
class OutlineViewShell;
|
2006-02-01 11:51:38 +00:00
|
|
|
class OutlineViewModelChangeGuard;
|
2008-01-28 13:55:55 +00:00
|
|
|
class DrawDocShell;
|
2004-01-20 10:37:53 +00:00
|
|
|
|
|
|
|
static const int MAX_OUTLINERVIEWS = 4;
|
|
|
|
|
2013-03-13 17:55:26 +01:00
|
|
|
/**
|
|
|
|
* Derivative of ::sd::View for the outline mode
|
2004-01-20 10:37:53 +00:00
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
class OutlineView
|
|
|
|
: public ::sd::View
|
|
|
|
{
|
2006-01-10 13:31:38 +00:00
|
|
|
friend class OutlineViewModelChangeGuard;
|
2004-01-20 10:37:53 +00:00
|
|
|
public:
|
2012-02-01 19:58:05 +04:00
|
|
|
OutlineView (DrawDocShell& rDocSh,
|
2015-04-28 23:09:13 +03:00
|
|
|
vcl::Window* pWindow,
|
2012-02-01 19:58:05 +04:00
|
|
|
OutlineViewShell& rOutlineViewSh);
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~OutlineView() override;
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2004-11-16 15:12:35 +00:00
|
|
|
/** This method is called by the view shell that owns the view to tell
|
|
|
|
the view that it can safely connect to the application.
|
|
|
|
This method must not be called before the view shell is on the shell
|
|
|
|
stack.
|
|
|
|
*/
|
2015-04-14 12:44:47 +02:00
|
|
|
void ConnectToApplication();
|
|
|
|
void DisconnectFromApplication();
|
2004-11-16 15:12:35 +00:00
|
|
|
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2015-04-29 09:55:11 +02:00
|
|
|
static SdrTextObj* GetTitleTextObject(SdrPage* pPage);
|
|
|
|
static SdrTextObj* GetOutlineTextObject(SdrPage* pPage);
|
2006-01-10 13:31:38 +00:00
|
|
|
|
2015-04-29 09:55:11 +02:00
|
|
|
static SdrTextObj* CreateTitleTextObject(SdPage* pPage);
|
|
|
|
static SdrTextObj* CreateOutlineTextObject(SdPage* pPage);
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void AddWindowToPaintView(OutputDevice* pWin, vcl::Window* pWindow) override;
|
|
|
|
virtual void DeleteWindowFromPaintView(OutputDevice* pWin) override;
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2015-04-28 23:09:13 +03:00
|
|
|
OutlinerView* GetViewByWindow(vcl::Window* pWin) const;
|
2014-06-18 12:14:29 +02:00
|
|
|
SdrOutliner& GetOutliner() { return mrOutliner; }
|
2004-01-20 10:37:53 +00:00
|
|
|
|
|
|
|
Paragraph* GetPrevTitle(const Paragraph* pPara);
|
|
|
|
Paragraph* GetNextTitle(const Paragraph* pPara);
|
|
|
|
SdPage* GetActualPage();
|
2008-06-06 11:08:04 +00:00
|
|
|
SdPage* GetPageForParagraph( Paragraph* pPara );
|
2012-02-01 19:58:05 +04:00
|
|
|
Paragraph* GetParagraphForPage( ::Outliner& rOutl, SdPage* pPage );
|
2004-01-20 10:37:53 +00:00
|
|
|
|
|
|
|
/** selects the paragraph for the given page at the outliner view*/
|
|
|
|
void SetActualPage( SdPage* pActual );
|
|
|
|
|
2015-01-20 12:38:10 +02:00
|
|
|
void Paint (const Rectangle& rRect, ::sd::Window* pWin);
|
2004-01-20 10:37:53 +00:00
|
|
|
|
|
|
|
// Callbacks fuer LINKs
|
2015-10-02 08:37:23 +02:00
|
|
|
DECL_LINK_TYPED( ParagraphInsertedHdl, ::Outliner *, void );
|
|
|
|
DECL_LINK_TYPED( ParagraphRemovingHdl, ::Outliner *, void );
|
|
|
|
DECL_LINK_TYPED( DepthChangedHdl, ::Outliner *, void );
|
2015-09-16 08:38:23 +02:00
|
|
|
DECL_LINK_TYPED( StatusEventHdl, EditStatus&, void );
|
2015-10-02 08:37:23 +02:00
|
|
|
DECL_LINK_TYPED( BeginMovingHdl, ::Outliner *, void );
|
|
|
|
DECL_LINK_TYPED( EndMovingHdl, ::Outliner *, void );
|
2015-07-12 21:13:57 +02:00
|
|
|
DECL_LINK_TYPED( RemovingPagesHdl, OutlinerView *, bool );
|
2015-07-13 11:21:01 +02:00
|
|
|
DECL_LINK_TYPED( IndentingPagesHdl, OutlinerView *, bool );
|
2015-09-16 13:02:21 +02:00
|
|
|
DECL_LINK_TYPED( BeginDropHdl, EditView*, void );
|
|
|
|
DECL_LINK_TYPED( EndDropHdl, EditView*, void );
|
2015-07-12 21:13:57 +02:00
|
|
|
DECL_LINK_TYPED( PaintingFirstLineHdl, PaintFirstLineInfo*, void );
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2014-06-09 10:09:42 +02:00
|
|
|
sal_uLong GetPaperWidth() { return mnPaperWidth;}
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2014-04-24 10:52:02 +02:00
|
|
|
bool PrepareClose(bool bUI = true);
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2016-01-14 11:44:28 +02:00
|
|
|
virtual void GetAttributes( SfxItemSet& rTargetSet, bool bOnlyHardAttr = false ) const override;
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll = false) override;
|
2004-01-20 10:37:53 +00:00
|
|
|
|
|
|
|
void FillOutliner();
|
|
|
|
void SetLinks();
|
|
|
|
void ResetLinks() const;
|
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
SfxStyleSheet* GetStyleSheet() const override;
|
2004-01-20 10:37:53 +00:00
|
|
|
|
|
|
|
void SetSelectedPages();
|
|
|
|
|
|
|
|
virtual sal_Int8 AcceptDrop (
|
|
|
|
const AcceptDropEvent& rEvt,
|
|
|
|
DropTargetHelper& rTargetHelper,
|
2016-08-01 09:51:02 +02:00
|
|
|
::sd::Window* pTargetWindow,
|
2016-08-05 11:59:19 +02:00
|
|
|
sal_uInt16 nPage,
|
2016-08-29 08:50:28 +02:00
|
|
|
sal_uInt16 nLayer) override;
|
2004-01-20 10:37:53 +00:00
|
|
|
virtual sal_Int8 ExecuteDrop (
|
|
|
|
const ExecuteDropEvent& rEvt,
|
2016-08-01 09:51:02 +02:00
|
|
|
::sd::Window* pTargetWindow,
|
2016-08-05 11:59:19 +02:00
|
|
|
sal_uInt16 nPage,
|
2016-08-29 08:50:28 +02:00
|
|
|
sal_uInt16 nLayer) override;
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2010-12-05 00:16:48 +02:00
|
|
|
// Re-implement GetScriptType for this view to get correct results
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual SvtScriptType GetScriptType() const override;
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2005-04-12 15:56:04 +00:00
|
|
|
/** After this method has been called with <TRUE/> following changes of
|
|
|
|
the current page are ignored in that the corresponding text is not
|
|
|
|
selected.
|
2014-04-29 19:25:03 +00:00
|
|
|
This is used to suppress unwanted side effects between selection and
|
2005-04-12 15:56:04 +00:00
|
|
|
cursor position.
|
|
|
|
*/
|
|
|
|
void IgnoreCurrentPageChanges (bool bIgnore);
|
2008-06-06 11:08:04 +00:00
|
|
|
|
|
|
|
/** creates and inserts an empty slide for the given paragraph. */
|
|
|
|
SdPage* InsertSlideForParagraph( Paragraph* pPara );
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
void UpdateParagraph( sal_Int32 nPara );
|
2008-06-06 11:08:04 +00:00
|
|
|
|
|
|
|
protected:
|
2016-02-11 22:07:09 +00:00
|
|
|
virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfo ) override;
|
|
|
|
virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfo ) override;
|
2008-06-06 11:08:04 +00:00
|
|
|
|
2004-01-20 10:37:53 +00:00
|
|
|
private:
|
2006-01-10 13:31:38 +00:00
|
|
|
/** call this method before you do anything that can modify the outliner
|
|
|
|
and or the drawing document model. It will create needed undo actions */
|
|
|
|
void BeginModelChange();
|
|
|
|
|
|
|
|
/** call this method after BeginModelChange(), when all possible model
|
|
|
|
changes are done. */
|
|
|
|
void EndModelChange();
|
|
|
|
|
|
|
|
/** merge edit engine undo actions if possible */
|
|
|
|
void TryToMergeUndoActions();
|
|
|
|
|
|
|
|
/** updates all changes in the outliner model to the draw model */
|
|
|
|
void UpdateDocument();
|
|
|
|
|
2012-02-01 19:58:05 +04:00
|
|
|
OutlineViewShell& mrOutlineViewShell;
|
|
|
|
SdrOutliner& mrOutliner;
|
2006-12-12 16:35:42 +00:00
|
|
|
OutlinerView* mpOutlinerView[MAX_OUTLINERVIEWS];
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2011-03-14 16:51:38 +01:00
|
|
|
std::vector<Paragraph*> maOldParaOrder;
|
|
|
|
std::vector<Paragraph*> maSelectedParas;
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 mnPagesToProcess; // for the progress bar
|
|
|
|
sal_Int32 mnPagesProcessed;
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2014-04-24 10:52:02 +02:00
|
|
|
bool mbFirstPaint;
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2014-02-03 19:53:40 +01:00
|
|
|
sal_uLong mnPaperWidth;
|
|
|
|
|
2006-12-12 16:35:42 +00:00
|
|
|
SfxProgress* mpProgress;
|
2004-01-20 10:37:53 +00:00
|
|
|
|
|
|
|
/** stores the last used document color.
|
|
|
|
this is changed in onUpdateStyleSettings()
|
|
|
|
*/
|
|
|
|
Color maDocColor;
|
|
|
|
|
|
|
|
/** updates the high contrast settings and document color if they changed.
|
|
|
|
@param bForceUpdate forces the method to set all style settings
|
|
|
|
*/
|
2016-08-01 09:51:02 +02:00
|
|
|
void onUpdateStyleSettings( bool bForceUpdate );
|
2004-01-20 10:37:53 +00:00
|
|
|
|
2015-06-16 13:16:03 +02:00
|
|
|
/** this link is called from the vcl application when the stylesettings
|
2004-01-20 10:37:53 +00:00
|
|
|
change. Its only purpose is to call onUpdateStyleSettings() then.
|
|
|
|
*/
|
2015-09-21 08:03:25 +02:00
|
|
|
DECL_LINK_TYPED( AppEventListenerHdl, VclSimpleEvent&, void );
|
2005-04-12 15:56:04 +00:00
|
|
|
|
2015-09-17 14:33:58 +02:00
|
|
|
DECL_LINK_TYPED(EventMultiplexerListener, sd::tools::EventMultiplexerEvent&, void);
|
2006-02-01 11:51:38 +00:00
|
|
|
|
|
|
|
/** holds a model guard during drag and drop between BeginMovingHdl and EndMovingHdl */
|
2014-10-01 15:03:54 +02:00
|
|
|
std::unique_ptr< OutlineViewModelChangeGuard > maDragAndDropModelGuard;
|
2008-06-06 11:08:04 +00:00
|
|
|
|
2015-04-28 23:09:13 +03:00
|
|
|
vcl::Font maPageNumberFont;
|
|
|
|
vcl::Font maBulletFont;
|
2008-06-06 11:08:04 +00:00
|
|
|
|
|
|
|
SvxLRSpaceItem maLRSpaceItem;
|
|
|
|
Image maSlideImage;
|
2004-01-20 10:37:53 +00:00
|
|
|
};
|
|
|
|
|
2005-05-02 12:18:19 +00:00
|
|
|
// calls IgnoreCurrentPageChangesLevel with true in ctor and with false in dtor
|
|
|
|
class OutlineViewPageChangesGuard
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
OutlineViewPageChangesGuard( OutlineView* pView );
|
|
|
|
~OutlineViewPageChangesGuard();
|
|
|
|
private:
|
|
|
|
OutlineView* mpView;
|
|
|
|
};
|
|
|
|
|
2006-01-10 13:31:38 +00:00
|
|
|
// calls BeginModelChange() on c'tor and EndModelChange() on d'tor
|
|
|
|
class OutlineViewModelChangeGuard
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
OutlineViewModelChangeGuard( OutlineView& rView );
|
|
|
|
~OutlineViewModelChangeGuard();
|
|
|
|
private:
|
|
|
|
OutlineView& mrView;
|
|
|
|
};
|
|
|
|
|
2004-01-20 10:37:53 +00:00
|
|
|
} // end of namespace sd
|
|
|
|
|
|
|
|
#endif
|
2010-10-27 12:53:26 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|