Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
9cf4be5c
Kaydet (Commit)
9cf4be5c
authored
Agu 08, 2013
tarafından
Krisztian Pinter
Kaydeden (comit)
Jan Holesovsky
Tem 20, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
startcenter: Add RecentDocsView for displaying thumbnails for recent docs
Change-Id: I6d9bb87a6ee28d62ee012e6807d1c5a4f3219e27
üst
f807403f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
326 additions
and
1 deletion
+326
-1
recentdocsview.hxx
include/sfx2/recentdocsview.hxx
+61
-0
recentdocsviewitem.hxx
include/sfx2/recentdocsviewitem.hxx
+26
-0
thumbnailviewitem.hxx
include/sfx2/thumbnailviewitem.hxx
+1
-1
Library_sfx.mk
sfx2/Library_sfx.mk
+2
-0
recentdocsview.cxx
sfx2/source/control/recentdocsview.cxx
+183
-0
recentdocsviewitem.cxx
sfx2/source/control/recentdocsviewitem.cxx
+53
-0
No files found.
include/sfx2/recentdocsview.hxx
0 → 100644
Dosyayı görüntüle @
9cf4be5c
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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/.
*/
#ifndef __SFX2_RECENTDOCSVIEW_HXX__
#define __SFX2_RECENTDOCSVIEW_HXX__
#include <sfx2/thumbnailview.hxx>
#include <sfx2/recentdocsviewitem.hxx>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
struct
LoadRecentFile
{
::
com
::
sun
::
star
::
util
::
URL
aTargetURL
;
::
com
::
sun
::
star
::
uno
::
Sequence
<
::
com
::
sun
::
star
::
beans
::
PropertyValue
>
aArgSeq
;
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
frame
::
XDispatch
>
xDispatch
;
};
class
SFX2_DLLPUBLIC
RecentDocsView
:
protected
::
comphelper
::
OBaseMutex
,
public
ThumbnailView
{
public
:
RecentDocsView
(
Window
*
pParent
);
virtual
~
RecentDocsView
();
void
insertItem
(
const
OUString
&
rURL
,
const
OUString
&
rTitle
);
void
loadRecentDocs
();
virtual
Size
GetOptimalSize
()
const
;
void
SetThumbnailSize
(
long
ThumbnailWidth
,
long
ThumbnailHeight
);
void
SetHeight
(
long
Height
);
DECL_STATIC_LINK
(
RecentDocsView
,
ExecuteHdl_Impl
,
LoadRecentFile
*
);
protected
:
virtual
void
OnItemDblClicked
(
ThumbnailViewItem
*
pItem
);
long
mnItemMaxWidth
;
long
mnItemMaxHeight
;
long
mnItemPadding
;
long
mnItemMaxTextLength
;
long
mnItemThumbnailMaxHeight
;
long
mnItemMaxHeightSub
;
long
mnHeight
;
int
mnMaxThumbnailItems
;
};
#endif // __SFX2_RECENTDOCSVIEW_HXX__
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
include/sfx2/recentdocsviewitem.hxx
0 → 100644
Dosyayı görüntüle @
9cf4be5c
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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/.
*/
#ifndef __SFX2_RECENTDOCSVIEWITEM_HXX__
#define __SFX2_RECENTDOCSVIEWITEM_HXX__
#include <sfx2/thumbnailview.hxx>
class
RecentDocsViewItem
:
public
ThumbnailViewItem
{
public
:
RecentDocsViewItem
(
ThumbnailView
&
rView
,
const
OUString
&
rURL
,
const
OUString
&
rTitle
);
virtual
void
setEditTitle
(
bool
edit
,
bool
bChangeFocus
=
true
);
OUString
maURL
;
};
#endif // __SFX2_RECENTDOCSVIEWITEM_HXX__
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
include/sfx2/thumbnailviewitem.hxx
Dosyayı görüntüle @
9cf4be5c
...
...
@@ -89,7 +89,7 @@ public:
void
setHighlight
(
bool
state
);
void
setEditTitle
(
bool
edit
,
bool
bChangeFocus
=
true
);
v
irtual
v
oid
setEditTitle
(
bool
edit
,
bool
bChangeFocus
=
true
);
void
updateTitleEditSize
();
virtual
void
setTitle
(
const
OUString
&
rTitle
);
...
...
sfx2/Library_sfx.mk
Dosyayı görüntüle @
9cf4be5c
...
...
@@ -134,6 +134,8 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/control/msgpool \
sfx2/source/control/objface \
sfx2/source/control/querystatus \
sfx2/source/control/recentdocsview \
sfx2/source/control/recentdocsviewitem \
sfx2/source/control/request \
sfx2/source/control/sfxstatuslistener \
sfx2/source/control/shell \
...
...
sfx2/source/control/recentdocsview.cxx
0 → 100644
Dosyayı görüntüle @
9cf4be5c
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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 .
*/
#include <sfx2/recentdocsview.hxx>
#include <comphelper/configurationhelper.hxx>
#include <sfx2/templateabstractview.hxx>
#include <sfx2/app.hxx>
#include <unotools/historyoptions.hxx>
#include <vcl/builder.hxx>
#include <vcl/svapp.hxx>
#include <tools/urlobj.hxx>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XFrame.hpp>
using
namespace
::
com
::
sun
::
star
;
using
namespace
com
::
sun
::
star
::
uno
;
using
namespace
com
::
sun
::
star
::
lang
;
using
namespace
com
::
sun
::
star
::
frame
;
using
namespace
com
::
sun
::
star
::
beans
;
static
const
char
SFX_REFERER_USER
[]
=
"private:user"
;
RecentDocsView
::
RecentDocsView
(
Window
*
pParent
)
:
ThumbnailView
(
pParent
)
,
mnItemMaxWidth
(
130
)
,
mnItemMaxHeight
(
130
)
,
mnItemPadding
(
0
)
,
mnItemMaxTextLength
(
30
)
,
mnItemThumbnailMaxHeight
(
150
)
,
mnItemMaxHeightSub
(
160
)
,
mnHeight
(
260
)
,
mnMaxThumbnailItems
(
50
)
{
setItemMaxTextLength
(
mnItemMaxTextLength
);
setItemDimensions
(
mnItemMaxWidth
,
mnItemThumbnailMaxHeight
,
mnItemMaxHeight
-
mnItemThumbnailMaxHeight
,
mnItemPadding
);
}
extern
"C"
SAL_DLLPUBLIC_EXPORT
Window
*
SAL_CALL
makeRecentDocsView
(
Window
*
pParent
,
VclBuilder
::
stringmap
&
)
{
return
new
RecentDocsView
(
pParent
);
}
RecentDocsView
::~
RecentDocsView
()
{
}
void
RecentDocsView
::
insertItem
(
const
OUString
&
rURL
,
const
OUString
&
rTitle
)
{
RecentDocsViewItem
*
pChild
=
new
RecentDocsViewItem
(
*
this
,
rURL
,
rTitle
);
AppendItem
(
pChild
);
}
void
RecentDocsView
::
loadRecentDocs
()
{
Clear
();
Sequence
<
Sequence
<
PropertyValue
>
>
aHistoryList
=
SvtHistoryOptions
().
GetList
(
ePICKLIST
);
int
nRecentThumbnailItems
=
mnMaxThumbnailItems
<
aHistoryList
.
getLength
()
?
mnMaxThumbnailItems
:
aHistoryList
.
getLength
();
for
(
int
i
=
0
;
i
<
nRecentThumbnailItems
;
i
++
)
{
Sequence
<
PropertyValue
>&
rRecentEntry
=
aHistoryList
[
i
];
OUString
aURL
;
OUString
aTitle
;
for
(
int
j
=
0
;
j
<
rRecentEntry
.
getLength
();
j
++
)
{
Any
a
=
rRecentEntry
[
j
].
Value
;
if
(
rRecentEntry
[
j
].
Name
==
"URL"
)
a
>>=
aURL
;
else
if
(
rRecentEntry
[
j
].
Name
==
"Title"
)
a
>>=
aTitle
;
}
insertItem
(
aURL
,
aTitle
);
}
CalculateItemPositions
();
Invalidate
();
}
void
RecentDocsView
::
OnItemDblClicked
(
ThumbnailViewItem
*
pItem
)
{
RecentDocsViewItem
*
pRecentItem
=
dynamic_cast
<
RecentDocsViewItem
*>
(
pItem
);
Reference
<
XDispatch
>
xDispatch
;
Reference
<
XDispatchProvider
>
xDispatchProvider
;
css
::
util
::
URL
aTargetURL
;
Sequence
<
PropertyValue
>
aArgsList
;
uno
::
Reference
<
frame
::
XDesktop2
>
xDesktop
=
frame
::
Desktop
::
create
(
::
comphelper
::
getProcessComponentContext
()
);
uno
::
Reference
<
frame
::
XFrame
>
xActiveFrame
=
xDesktop
->
getActiveFrame
();
osl
::
ClearableMutexGuard
aLock
(
m_aMutex
);
xDispatchProvider
=
Reference
<
XDispatchProvider
>
(
xActiveFrame
,
UNO_QUERY
);
aLock
.
clear
();
aTargetURL
.
Complete
=
pRecentItem
->
maURL
;
Reference
<
::
com
::
sun
::
star
::
util
::
XURLTransformer
>
xTrans
(
::
com
::
sun
::
star
::
util
::
URLTransformer
::
create
(
::
comphelper
::
getProcessComponentContext
()
)
);
xTrans
->
parseStrict
(
aTargetURL
);
sal_Int32
nSize
=
2
;
aArgsList
.
realloc
(
nSize
);
aArgsList
[
0
].
Name
=
"Referer"
;
aArgsList
[
0
].
Value
=
makeAny
(
OUString
(
SFX_REFERER_USER
)
);
// documents will never be opened as templates
aArgsList
[
1
].
Name
=
"AsTemplate"
;
aArgsList
[
1
].
Value
=
makeAny
(
(
sal_Bool
)
sal_False
);
xDispatch
=
xDispatchProvider
->
queryDispatch
(
aTargetURL
,
"_default"
,
0
);
if
(
xDispatch
.
is
()
)
{
// Call dispatch asychronously as we can be destroyed while dispatch is
// executed. VCL is not able to survive this as it wants to call listeners
// after select!!!
LoadRecentFile
*
pLoadRecentFile
=
new
LoadRecentFile
;
pLoadRecentFile
->
xDispatch
=
xDispatch
;
pLoadRecentFile
->
aTargetURL
=
aTargetURL
;
pLoadRecentFile
->
aArgSeq
=
aArgsList
;
Application
::
PostUserEvent
(
STATIC_LINK
(
0
,
RecentDocsView
,
ExecuteHdl_Impl
),
pLoadRecentFile
);
}
}
void
RecentDocsView
::
SetThumbnailSize
(
long
ThumbnailWidth
,
long
ThumbnailHeight
)
{
mnItemMaxWidth
=
ThumbnailWidth
;
mnItemMaxHeight
=
ThumbnailHeight
;
setItemDimensions
(
mnItemMaxWidth
,
mnItemThumbnailMaxHeight
,
mnItemMaxHeight
-
mnItemThumbnailMaxHeight
,
mnItemPadding
);
}
void
RecentDocsView
::
SetHeight
(
long
Height
)
{
mnHeight
=
Height
;
}
Size
RecentDocsView
::
GetOptimalSize
()
const
{
return
Size
(
Window
::
GetOptimalSize
().
Width
(),
mnHeight
);
}
IMPL_STATIC_LINK_NOINSTANCE
(
RecentDocsView
,
ExecuteHdl_Impl
,
LoadRecentFile
*
,
pLoadRecentFile
)
{
try
{
// Asynchronous execution as this can lead to our own destruction!
// Framework can recycle our current frame and the layout manager disposes all user interface
// elements if a component gets detached from its frame!
pLoadRecentFile
->
xDispatch
->
dispatch
(
pLoadRecentFile
->
aTargetURL
,
pLoadRecentFile
->
aArgSeq
);
}
catch
(
const
Exception
&
)
{
}
delete
pLoadRecentFile
;
return
0
;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sfx2/source/control/recentdocsviewitem.cxx
0 → 100644
Dosyayı görüntüle @
9cf4be5c
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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/.
*/
#include <sfx2/recentdocsviewitem.hxx>
#include <sfx2/sfxresid.hxx>
#include "../doc/doc.hrc"
#include <sfx2/templateabstractview.hxx>
#include <tools/urlobj.hxx>
RecentDocsViewItem
::
RecentDocsViewItem
(
ThumbnailView
&
rView
,
const
OUString
&
rURL
,
const
OUString
&
rTitle
)
:
ThumbnailViewItem
(
rView
)
{
OUString
aTitle
=
rTitle
;
if
(
!
aTitle
.
getLength
()
)
{
// If we have no title, get filename from the URL
INetURLObject
aURLObj
(
rURL
);
aTitle
=
aURLObj
.
GetName
(
INetURLObject
::
DECODE_WITH_CHARSET
);
}
BitmapEx
aThumbnail
=
ThumbnailView
::
readThumbnail
(
rURL
);
if
(
aThumbnail
.
IsEmpty
()
)
{
// Use the default thumbnail if we have nothing else
aThumbnail
=
TemplateAbstractView
::
getDefaultThumbnail
(
rURL
);
}
if
(
aThumbnail
.
IsEmpty
()
)
{
// Last fallback
aThumbnail
=
BitmapEx
(
SfxResId
(
SFX_THUMBNAIL_TEXT
)
);
}
maURL
=
rURL
;
maTitle
=
aTitle
;
maPreview1
=
TemplateAbstractView
::
scaleImg
(
aThumbnail
,
150
,
150
);
}
void
RecentDocsViewItem
::
setEditTitle
(
bool
edit
,
bool
bChangeFocus
)
{
// Unused parameters.
(
void
)
edit
;
(
void
)
bChangeFocus
;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment